VimUnDo'YGʑ} a$-{X }.bind(this));IIIIV_=H_NV"NPZNOZ5_OV"OQ\ OQ[5_OV;NP\>Renderer.prototype.drawSprite = function(name, x, y, dw, dh) {5_O'V;NP\=fmpVVegu 0.0, dh, 0.0 // bottom left5_=?>ampVV`bu 0.0, 0.0, 0.0, // top left5_>@?` mpVV_au" x + dw, 0.0, 0.0, // top right5_?A@ampVV`bu x, 0.0, 0.0, // top left5_@BAdmpVVceu x, 0.0, 0.0, // top left5_ACBdmpVVceu x, y, 0.0, // top left5_BDCdmpVVceu x, y, 0.0, // top left5_CEDfmpVVegu x, dh, 0.0 // bottom left5_DFE` mpVV_au x + dw, y, 0.0, // top right5_EGFampVV`bu x, y, 0.0, // top left5_FHG` mpVV _au x + dw, y, 0.0, // top right5_GIHb mpVV acu# x + dw, dh, 0.0, // bottom right5_HJIampVV`bu x, y, 0.0, // top left5_IKJb mpVVacu" x + dw, dh, 0.0, // bottom right5_JLKe mpVVdfu# x + dw, dh, 0.0, // bottom right5_KMLfmpVVegu x, dh, 0.0 // bottom left5_LNM_mpVV*^`u this.spriteCoords.set([_`u5_MON_mpVV.^`u this.spriteCoords.set([5_NQO_mpVV/^`u this.spriteCoords.set([5_ORPQgmpVV;fhu ], this.currSprite * 30);ghu5_QSRgmpVV>fhu ], this.currSprite * 30);5_RTSgmpVV>fhu ], this.currSprite * 30);5_SUThmpVVCgiu this.currSprite++;hiu5_TVUhmpVVDgiu this.currSprite++;5_UWVhmpVVDgiu this.currSprite++;5_VXWZmpVVLY[u$ this.currTexture = sprite.texture;Z[u5_WYXZmpVVMY[u% this.currTexture = sprite.texture;5_XZYZmpVVMY[u$ this.currTexture = sprite.texture;5_Y[ZRmpVVSQSu8 this.spriteCoords = new Float32Array(numSprites * 30);RSu5_Z\[RmpVVSQSu9 this.spriteCoords = new Float32Array(numSprites * 30);5_[]\RmpVVTQSu8 this.spriteCoords = new Float32Array(numSprites * 30);5_\^]SmpVVVRTu this.currSprite = 0;STu5_]_^SmpVVVRTu this.currSprite = 0;5_^`_SmpVVWRTu this.currSprite = 0;5__a``mpVV _au x + dw, y, 0.0, // top right5_`baa mpVV$`bu x, y, 0.0, // top left5_acbbmpVV(acu& x + dw, y + dh, 0.0, // bottom right5_bdcfmpVV.egu x, y + dh, 0.0 // bottom left5_cedfDmpVV0eguU x, y + dh, 0.0sprite.textureCoords.right, sprite.textureCoords.top, // bottom left5_dfefDmpVV0eguT x, y + dh, 0.0sprite.textureCoords.right, sprite.textureCoords.top // bottom left5_egffmpVV4eguS x, y + dh, 0.0sprite.textureCoords.right, sprite.textureCoords.top // bottom left5_fhga"a"a'v)V=`buN x, y, 0.0, sprite.textureCoords.right, sprite.textureCoords.top, // top left5_gihbHa"a'v)VNacu\ x + dw, y + dh, 0.0, sprite.textureCoords.right, sprite.textureCoords.top, // bottom right5_hjica"a'v)VScfucdu5_ikjfa"a'v)V[ef x, y, 0.0, // top left' x + dw, y + dh, 0.0, // bottom right5_jlkf'a"a'v)VaeguU x, y + dh, 0.0, sprite.textureCoords.right, sprite.textureCoords.top // bottom left5_kmlfBa"a'v)Vd eguT x, y + dh, 0.0, sprite.textureCoords.left, sprite.textureCoords.top // bottom left5_lnmia"a'v)VѦikuiju5_monja"a'v)Vѩjlvjkv5_npoja"a'v)VѬikw=Renderer.prototype.addSprite = function(name, x, y, dw, dh) {5_orpj$a"a'v)Vѱ ikw9Renderer.prototype.flush = function(name, x, y, dw, dh) {5_psqrj8FVVjzwjkw5_rtsj8FVVjl5_sutk8FVVkm km5_tvul 8FVV npnpnpkp var buffer5_uwvn!8FVV9mo! gl.bufferData(gl.ARRAY_BUFFER, 5_vxwo8FVVNno  );5_wyxo8FVVPnpop5_xzyppqVVdopI var vertexCoords = buildBuffer(this.gl, 3, makeRectangleCoords(dw, dh));8 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, vertexCoords);5_y{zpIppVVoq| this.gl.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute, vertexCoords.itemSize, this.gl.FLOAT, false, 0, 0);5_z|{pbppVVoqh this.gl.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute, 3, this.gl.FLOAT, false, 0, 0);5_{}|ptppVVoqy this.gl.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords., 0);5_|~}pppVVprpq5_}~q0ppVVpr this.gl.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);5_~qGppVVpr this.gl.vertexAttribPointer(this.shaderProgram.textureCoordAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);5_qppVV&pr this.gl.vertexAttribPointer(this.shaderProgram.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);qr5_qppVV(pr this.gl.vertexAttribPointer(this.shaderProgram.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 50);5_qppVV*pr this.gl.vertexAttribPointer(this.shaderProgram.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 0);5_s"ppVVJrs# var coords = sprite.textureCoords;2 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, coords);5_sppVVNrst this.gl.vertexAttribPointer(this.shaderProgram.textureCoordAttribute, coords.itemSize, this.gl.FLOAT, false, 0, 0);5_t)ppVV[su9 this.gl.bindTexture(this.gl.TEXTURE_2D, sprite.texture);5_wppVVvw9 mat4.translate(this.mvMatrix, this.camera, [x, y, 0.0]);5_wJppVVvxT this.gl.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform, false, this.mvMatrix);5_y$ppVVxzF this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, vertexCoords.numItems);5_y*ppVVԁ xzA this.gl.drawArrays(this.gl.TRIANGLES, 0, vertexCoords.numItems);5_lppVVԍkm& var buffer = this.gl.createBuffer();lm5_mppVVԎln) gl.bindBuffer(gl.ARRAY_BUFFER, buffer);mn5_nppVVԎmoD gl.bufferData(gl.ARRAY_BUFFER, this.spriteCoords, gl.STATIC_DRAW);no5_lppVVԏkm' var buffer = this.gl.createBuffer();5_lppVVԐkm& var buffer = this.gl.createBuffer();5_mppVVԐln* gl.bindBuffer(gl.ARRAY_BUFFER, buffer);5_mppVVԐln) gl.bindBuffer(gl.ARRAY_BUFFER, buffer);5_nppVVԐmoE gl.bufferData(gl.ARRAY_BUFFER, this.spriteCoords, gl.STATIC_DRAW);5_nppVVԐ moD gl.bufferData(gl.ARRAY_BUFFER, this.spriteCoords, gl.STATIC_DRAW);5_mppVVԕln( gl.bindBuffer(gl.ARRAY_BUFFER, buffer);5_nppVVԗmoC gl.bufferData(gl.ARRAY_BUFFER, this.spriteCoords, gl.STATIC_DRAW);5_n8ppVVԚmoH gl.bufferData(this.gl.ARRAY_BUFFER, this.spriteCoords, gl.STATIC_DRAW);5_mppVVԠln- gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);5_nppVVԢmoM gl.bufferData(this.gl.ARRAY_BUFFER, this.spriteCoords, this.gl.STATIC_DRAW);5_yRSVVy|yz5_zRSVVy{z{5_{RSVVz|7 this.spriteCoords = new Float32Array(numSprites * 30);5_{RSVVz|> delete this.spriteCoords = new Float32Array(numSprites * 30);5_|RSVV{} this.currSprite = 0;5_|RSVV!{} this.currSprite;5_|RSVV&|~|}5_}RSVV*|~ delete this.currSprite;5_pRSVVBprpq5_qRSVVEprqr5_qRSVVNpr(gl.enableVertexAttribArray(a_PointSize);qr5_qERSVVOprRgl.enableVertexAttribArray(this.shaderProgram.vertexPositionAttributea_PointSize);5_qRSVVUprGgl.enableVertexAttribArray(this.shaderProgram.vertexPositionAttribute);qr5_qRSVVXqsqr5_sRSVV[sust5_t/RSVVwsuH gl.enableVertexAttribArray(this.shaderProgram.vertexPositionAttribute);tu5_tDRSVVxsu] gl.enableVertexAttribArray(this.shaderProgram.textureCoordAttributevertexPositionAttribute);5_tRSVVׁsuF gl.enableVertexAttribArray(this.shaderProgram.textureCoordAttribute);5_qRSVVׄprH gl.enableVertexAttribArray(this.shaderProgram.vertexPositionAttribute);5_ppuVVׇop this.gl.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);M this.gl.enableVertexAttribArray(this.shaderProgram.vertexPositionAttribute); this.gl.vertexAttribPointer(this.shaderProgram.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);K this.gl.enableVertexAttribArray(this.shaderProgram.textureCoordAttribute);5_uppVV׊u|uv5_lloVV׬kl% var buffer = this.gl.createBuffer();2 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);R this.gl.bufferData(this.gl.ARRAY_BUFFER, this.spriteCoords, this.gl.STATIC_DRAW);5_qllVVװqvqr5_|9llVVt{}; this.gl.drawArrays(this.gl.TRIANGLES, 0, this.currSprite);5_|<llVVo{}? this.gl.drawArrays(this.gl.TRIANGLES, 0, this.currSprite * 2);5_|<llVVq{}? this.gl.drawArrays(this.gl.TRIANGLES, 0, this.currSprite * u);5_~llVV>}~ delete this.spriteCoords;5_RllVVFQSRS5_RmmVVIQS7 this.spriteCoords = new Float32Array(numSprites * 30);5_R mmVVNQS var size p 5_R mmVVWQS var size =RS5_RmmVVXQS var size =numSprites * 305_R mmVVZQS var size =numSprites * 30;5_R mmVV]RT RT5_T&nnVV~TV TV5_TooVVۄSU7 this.spriteCoords = new Float32Array(numSprites * 30);TU5_SooVVۅRT( if (size > this.spriteCoords.length) {ST5_UooVVۆTV }UV5_SooVVۈRT) if (size > this.spriteCoords.length) {5_SooVVۈRT( if (size > this.spriteCoords.length) {5_UooVVۉTV }5_UooVVۊTV }5_SooVVRT' if (size > this.spriteCoords.length) {5_//!GV!VO./>Renderer.prototype.drawSprite = function(name, x, y, dw, dh) {! var sprite = this.sprites[name]; if (!sprite) { return; } dw = dw || sprite.width; dh = dh || sprite.height;I var vertexCoords = buildBuffer(this.gl, 3, makeRectangleCoords(dw, dh));8 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, vertexCoords);| this.gl.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute, vertexCoords.itemSize, this.gl.FLOAT, false, 0, 0);# var coords = sprite.textureCoords;2 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, coords);t this.gl.vertexAttribPointer(this.shaderProgram.textureCoordAttribute, coords.itemSize, this.gl.FLOAT, false, 0, 0);) this.gl.activeTexture(this.gl.TEXTURE0);9 this.gl.bindTexture(this.gl.TEXTURE_2D, sprite.texture);9 this.gl.uniform1i(this.shaderProgram.samplerUniform, 0);9 mat4.translate(this.mvMatrix, this.camera, [x, y, 0.0]);T this.gl.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform, false, this.mvMatrix);F this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, vertexCoords.numItems);};5_/!/V!VX/var buildBuffer = require("./gl/build-buffer");5_kktVV^jk $function makeRectangleCoords(w, h) { var c = [ w, 0.0, 0.0, // top right 0.0, 0.0, 0.0, // top left w, h, 0.0, // bottom right 0.0, h, 0.0 // bottom left ]; return c;}5_6V(69k67k5_7V+68m*Renderer.prototype.fillRect = function() {5_V\mm5_V^nn5_Vapoon 5_Vp p5_Vp 5_Vp 5_Vp 5_Vp 5_Vp });p5_Vp });5_Vp });5_Vp });5_Vq p5_ %VV$qq5_&+VV var program =5_%*VVv@ var compiled = shaderManifest.shaders.filter(function(shader) {5_ " V V#v? var program = shaderManifest.shaders.filter(function(shader) {- return shader.scenes.indexOf(scene) !== -1; }).map(function(shader) {< return shaders.compile(this.gl, shader.type, shader.text); }.bind(this));u this.shaderProgram = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_" " V V!#vx this.shaderProgram = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_" " V V!#v programs[name] = this.shaderProgram = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_" " V V!#v programs[name] = .shaderProgram = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_" " V V!#v programs[name] = shaderProgram = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_" " V V!#vv programs[name] = = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_  " V V vB var program = shaderManifest.shaders.filter(function(shader) {5_"% " V V)"$w "$v5_$ " V V+ #$ 5_%%*VV/$%@ var compiled = shaderManifest.shaders.filter(function(shader) {- return shader.scenes.indexOf(scene) !== -1; }).map(function(shader) {< return shaders.compile(this.gl, shader.type, shader.text); }.bind(this));u this.shaderProgram = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_%%VV?pH var program = shaderManifest[name].shaders.filter(function(shader) {p5_%%VV@pI var program = shaderManifest[name].shaders.filter(function(shader) {p5_%%VVBp1 return shader.scenes.indexOf(scene) !== -1;p5_%%VVCp2 return shader.scenes.indexOf(scene) !== -1;p5_%%VVE p }).map(function(shader) { p5_%%VVE p }).map(function(shader) { p5_ %%VVG!p@ return shaders.compile(this.gl, shader.type, shader.text); !p5_ %%VVG!pA return shaders.compile(this.gl, shader.type, shader.text); !p5_!%%VVH "p }.bind(this));!"p5_!%%VVH "p }.bind(this));!"p5_"%%VVH!#pt programs[name] = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);"#p5_"%%VVI!#pu programs[name] = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);"#p5_#%%VVI"$p return programs;#$p5_#%%VVI"$p return programs;#$p5_%%VVMpJ var program = shaderManifest[name].shaders.filter(function(shader) {5_%%VVMpI var program = shaderManifest[name].shaders.filter(function(shader) {5_%%VVNpH var program = shaderManifest[name].shaders.filter(function(shader) {5_%%VVNpG var program = shaderManifest[name].shaders.filter(function(shader) {5_%%VVOp3 return shader.scenes.indexOf(scene) !== -1;5_%%VVOp2 return shader.scenes.indexOf(scene) !== -1;5_%%VVOp1 return shader.scenes.indexOf(scene) !== -1;5_%%VVOp0 return shader.scenes.indexOf(scene) !== -1;5_%%VVPp/ return shader.scenes.indexOf(scene) !== -1;5_ %%VVPp. return shader.scenes.indexOf(scene) !== -1;5_  %%VVQ p }).map(function(shader) {5_   %%VVQ p }).map(function(shader) {5_   %%VVQ p }).map(function(shader) {5_   %%VVQ p }).map(function(shader) {5_  %%VVR!pB return shaders.compile(this.gl, shader.type, shader.text);5_  %%VVR!pA return shaders.compile(this.gl, shader.type, shader.text);5_ %%VVR!p@ return shaders.compile(this.gl, shader.type, shader.text);5_ %%VVR!p? return shaders.compile(this.gl, shader.type, shader.text);5_ %%VVS!p> return shaders.compile(this.gl, shader.type, shader.text);5_ %%VVS!p= return shaders.compile(this.gl, shader.type, shader.text);5_!%%VVS "p }.bind(this));5_!%%VVT "p }.bind(this));5_!%%VVT "p }.bind(this));5_!%%VVT "p }.bind(this));5_"%%VVY!#pv programs[name] = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_#%%VVZ"$p return programs;5_%%VV_p- return shader.scenes.indexOf(scene) !== -1;p5_ %%VVa!!p< return shaders.compile(this.gl, shader.type, shader.text); !p5_%%VVn"pF var program = shaderManifest[name].shaders.filter(function(shader) {5_%%VVw#pF var shaders = shaderManifest[name].shaders.filter(function(shader) {5_+,%%VV*,pM this.gl.uniformMatrix4fv(this.shaderProgram.pMatrixUniform, false, pMatrix);5_+3%%VV+-p+,p5_ ,-%%VV$+-qU this.gl.uniformMatrix4fv(this.shaderProgram.sprites.pMatrixUniform, false, pMatrix);5_! ,3%%VV+-qU this.gl.uniformMatrix4fv(this.shaderProgram.squares.pMatrixUniform, false, pMatrix);5_ #!+3%%VV%*,qU this.gl.uniformMatrix4fv(this.shaderProgram.sprites.pMatrixUniform, false, pMatrix);5_!%"#%%VVq> Object.keys(shaderManifest).reduce(function(programs, name) {5_#&$%+,%%VV *,qT this.gl.uniformMatrix4fv(this.shaderProgram.sprite.pMatrixUniform, false, pMatrix);5_%'&,,%%VV &+-qT this.gl.uniformMatrix4fv(this.shaderProgram.square.pMatrixUniform, false, pMatrix);5_&('Z%%VV8YZ5_')(\%%%VV;[]p9 this.gl.uniform1i(this.shaderProgram.samplerUniform, 0);5_(*)^,%%VVC]_pR this.gl.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform, false, this.camera);5_)+*d/%%VVIcep this.gl.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);5_*,+e3%%VVJdfpM this.gl.enableVertexAttribArray(this.shaderProgram.vertexPositionAttribute);5_+-,g/%%VVLfhp this.gl.vertexAttribPointer(this.shaderProgram.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_,.-h3%%VVN)gipK this.gl.enableVertexAttribArray(this.shaderProgram.textureCoordAttribute);5_-/.$%%VVm*#%p }, {});5_.0/"A%%VV!#pr programs[name] = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_/10"j%%VV,!#px programs[name] = shaders.link(this.gl, compiled, shaderManifest[name].vertexAttribArrays, shaderManifest.uniformVars);5_021,%%VV:-+-U this.gl.uniformMatrix4fv(this.shaderPrograms.square.pMatrixUniform, false, pMatrix);5_132%%%VV %'p%&p5_243&%%VV &(r &(q5_354&%%VV&(s &(r5_465'%%VV&(s'(s5_576'%%VV&)s 5_687&%%VVN%'t-Renderer.prototype.setSize = function(w, h) {5_7:8&)%%VVR%'t0Renderer.prototype.useProgram = function(w, h) {5_8;9:+%%VV{*,t+,t5_:<;+%%VV}*,u+,u5_;=<+%%VV*-u 5_<>=,%%VV+-v,-v5_=?>,%%VV+-v 5_>@?1,%%VV02vU this.gl.uniformMatrix4fv(this.shaderPrograms.sprite.pMatrixUniform, false, pMatrix);5_?A@2%%VV12X // this.gl.uniformMatrix4fv(this.shaderPrograms.square.pMatrixUniform, false, pMatrix);5_@BA(%%VV')u) this.gl.useProgram(this.shaderProgram);()u5_ACB(%%VV')u* this.gl.useProgram(this.shaderProgram);5_BFC(%%VV')u) this.gl.useProgram(this.shaderProgram);5_CHEF(%%VV(*u()u5_FIGH)%%VV(*v)*v5_H^I)%%VV.(*v 5_I_J^2-%%VV313vT this.gl.uniformMatrix4fv(this.shaderProgram.sprite.pMatrixUniform, false, pMatrix);5_^`_2,%%VV3013vN this.gl.uniformMatrix4fv(this.shaderProgram..pMatrixUniform, false, pMatrix);5__a`C-%%VVNCEw CEv5_`baD%%VVaCEw this.useProgram("sprite");5_acbD%%VVd2CEwthis.useProgram("sprite");DEw5_bdc$DDV3$&w$%w5_ced;EEV;=x;<x5_dfe;FFV:<y this.drawSprite("text", x, y);5_egf<FFV;=y this.drawSprite("text", x, y);5_fhg<FFV;=y this.drawSprite();5_gih<FFV;< this.beginSprite();5_hji;EEV:<x;<x5_ikj;FFV:<y this.beginSprite();5_jlk<FFV <>y<=y5_kml=GGV 4<>z this.beginSprites();5_lnm;GGVQ5:<z this.beginSprites();5_monBGGVBDzBCz5_npoB'HHVAC{*Renderer.prototype.fillRect = function() {5_oqpCHHV7BC this.useProgram("sprite");5_prqDGGV8DFzDEz5_qsrD(HHV=CE{,Renderer.prototype.strokeRect = function() {DE{5_rusEHHVJEG{EF{5_svtuFIIVNEG|8 this.spriteCoords = new Float32Array(numSprites * 30);5_uwvF3IIVdEG|7 this.spriteCoords = new Float32Array(numSprites * 30);5_vxwF&IIVlEG|6 this.spriteCoords = new Float32Array(numSprites * 4);5_wyxF&Z b V V EH|- this.spriteCoords = new Float32Array(4 * 4);5_xzyG[ c V V 'FH} ]);GH}5_y{zG[ c V V (FH} ]);5_z|{G[ c V V (FH} ]);5_{}|F[ c V V *FH}FG}5_|~}G]cVV 8GO~GH~5_}~GdjVV :FG5_~GciVV AFHT x + dw, y, 0.0, sprite.textureCoords.right, sprite.textureCoords.top, // top right5_GciVV [FHS x + w, y, 0.0, sprite.textureCoords.right, sprite.textureCoords.top, // top right5_GciVV \FH9 x + w, y, 0.0, , sprite.textureCoords.top, // top right5_H ciVV bGIM x, y, 0.0, sprite.textureCoords.left, sprite.textureCoords.top, // top left5_HciVV cGI4 x, y, 0.0, , sprite.textureCoords.top, // top left5_IciVV fHJ_ x + dw, y + dh, 0.0, sprite.textureCoords.right, sprite.textureCoords.bottom, // bottom right5_IciVV gHJE x + dw, y + dh, 0.0, , sprite.textureCoords.bottom, // bottom right5_KciVV kJKM x, y, 0.0, sprite.textureCoords.left, sprite.textureCoords.top, // top left_ x + dw, y + dh, 0.0, sprite.textureCoords.right, sprite.textureCoords.bottom, // bottom right5_JagVV mIJ5_J`fVV rIKW x, y + dh, 0.0, sprite.textureCoords.left, sprite.textureCoords.bottom // bottom left5_J`fVV tIK> x, y + dh, 0.0, , sprite.textureCoords.bottom // bottom left5_I`fVV yHJ* x + dw, y + dh, 0.0, , , // bottom right5_J `fVV zIK# x, y + dh, 0.0, , // bottom left5_I `fVV {HJ) x + w, y + dh, 0.0, , , // bottom right5_G`fVV FH! x + w, y, 0.0, , , // top right5_G`fVV FH$ x + w, y, 0.0, 1.0, , // top right5_G`fVV FH' x + w, y, 0.0, 1.0, 1.0, // top right5_G`fVV FH' x + w, y, 0.0, 1.0, 0.0, // top right5_H `fVV GI x, y, 0.0, , , // top left5_H `fVV GI x, y, 0.0, 0.0, , // top left5_H`fVV GI$ x, y, 0.0, 1.0, 0.0, , // top left5_G`fVV FH1 x + w, y, 0.0, 1.0, 0.0, 0.0, 1.0, // top right5_H `fVV GI, x, y, 0.0, 1.0, 0.0, 0.0, 1.0, // top left5_H`fVV GI2 x, y, 0.0, 1.0, 0.0, 0.0, 1.0, // top left5_G`fVV FH3 x + w, y, 0.0, 1.0, 0.0, 0.0, 1.0, // top right5_I`fVV HJ( x + w, y + h, 0.0, , , // bottom right5_I`fVV HJ+ x + w, y + h, 0.0, 1.0, , // bottom right5_J`fVV IK" x, y + h, 0.0, , // bottom left5_J'`fVV 6IK8 x, y + h, 0.0, 1.0, 0.0, 0.0, 1.0, // bottom left5_Ko(|V)V KZKL5_F}(V)V EG' this.spriteCoords = new Float32Array([5_F}(V)V EG# .spriteCoords = new Float32Array([5_F}(V)V 7EG" spriteCoords = new Float32Array([5_P*}(V)V OQR this.gl.bufferData(this.gl.ARRAY_BUFFER, this.spriteCoords, this.gl.STATIC_DRAW);5_R1}(V)V QS this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);5_R}(V)V QS this.gl.vertexAttribPointer(this.shaderPrograms.square.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);5_U8}(V)V TV this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_UN}(V)V TV this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexColorAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_U}(V)V TV this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexColorAttribute, 4, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_Rj}(V)V QS this.gl.vertexAttribPointer(this.shaderPrograms.square.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 7, 0);5_Ug}(V)V TV this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexColorAttribute, 4, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 7, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_U}(V)V TV this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexColorAttribute, 4, this.gl.FLOAT, false, coords.BYTES_PER_ELEMENT * 7, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_U1}(V)V TV this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexColorAttribute, 4, this.gl.FLOAT, false, coords.BYTES_PER_ELEMENT * 7, coords.BYTES_PER_ELEMENT * 3);5_S5}(V)V RTU this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.vertexPositionAttribute);5_V5}(V)V UWS this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.textureCoordAttribute);5_V<}(V)V 8UWS this.gl.enableVertexAttribArray(this.shaderPrograms.square.textureCoordAttribute);5_X}(V)V WY? this.gl.drawArrays(this.gl.TRIANGLES, 0, this.currSprite * 6);5_X*}(V)V "9WY? this.gl.drawArrays(this.gl.LINE_LOOP, 0, this.currSprite * 6);5_Y}(V)V &XY5_B'|(V)V 5:AC4Renderer.prototype.fillRect = function(x, y, w, h) {5_E|(V)V c<DF this.useProgram("sprite");5_L.|(V)V =KMZ this.gl.uniformMatrix4fv(this.shaderPrograms.sprite.mvMatrixUniform, false, this.camera);5_H|(V)V GH4 x, y, 0.0, 1.0, 0.0, 0.0, 1.0, // top left5_G{(V)V >FHGH5_|(V)V+ "use strict";%var mat4 = require("gl-matrix").mat4;!var object = require("./object");#var shaders = require("./shaders");%var textures = require("./textures");.var TextRenderer = require("./text-renderer");function Renderer(gl) { this.gl = gl;( this.gl.clearColor(0.0, 0.0, 0.0, 1.0);C this.gl.blendFunc(this.gl.SRC_ALPHA, this.gl.ONE_MINUS_SRC_ALPHA); this.gl.enable(this.gl.BLEND); this.camera = mat4.create(); this.mvMatrix = mat4.create();/ this.textRenderer = new TextRenderer(this.gl);}ERenderer.prototype.loadSprites = function(textureManifests, images) {[ this.sprites = object.values(textureManifests).reduce(function(sprites, textureManifest) {) var image = textureManifest.meta.image;9 var t = textures.fromImage(this.gl, images.get(image));: var s = textures.toSprites(this.gl, t, textureManifest); object.merge(sprites, s); return sprites; }.bind(this), {});};IRenderer.prototype.buildShaderProgram = function(shaderManifest, scene) {T this.shaderPrograms = Object.keys(shaderManifest).reduce(function(programs, name) {G var compiled = shaderManifest[name].shaders.filter(function(shader) {. return shader.scenes.indexOf(scene) !== -1; }).map(function(shader) {= return shaders.compile(this.gl, shader.type, shader.text); }.bind(this));~ programs[name] = shaders.link(this.gl, compiled, shaderManifest[name].vertexAttribArrays, shaderManifest[name].uniformVars); return programs; }.bind(this), {}); this.useProgram("sprite");};0Renderer.prototype.useProgram = function(name) {0 this.shaderProgram = this.shaderPrograms[name];( this.gl.useProgram(this.shaderProgram);' this.setSize(this.width, this.height);};-Renderer.prototype.setSize = function(w, h) { this.width = w; this.height = h; this.gl.viewport(0, 0, w, h); var pMatrix = mat4.create();( mat4.ortho(pMatrix, 0, w, h, 0, -1, 1);M this.gl.uniformMatrix4fv(this.shaderProgram.pMatrixUniform, false, pMatrix);};/Renderer.prototype.setCamera = function(x, y) { mat4.identity(this.camera);9 mat4.translate(this.camera, this.camera, [-x, -y, 0.0]);};4Renderer.prototype.fillText = function(text, x, y) {Z this.sprites["text"] = this.textRenderer.fillText(text, x, y, this.font, this.fillStyle); this.beginSprites(1); this.addSprite("text", x, y); this.flush();};1Renderer.prototype.measureText = function(text) {G return this.textRenderer.measureText(text, this.font, this.fillStyle);};*Renderer.prototype.fillRect = function() {};6Renderer.prototype.strokeRect = function(x, y, w, h) { this.useProgram("square"); var coords = new Float32Array([4 x, y, 0.0, 1.0, 0.0, 0.0, 1.0, // top left5 x + w, y, 0.0, 1.0, 0.0, 0.0, 1.0, // top right8 x + w, y + h, 0.0, 1.0, 0.0, 0.0, 1.0, // bottom right7 x, y + h, 0.0, 1.0, 0.0, 0.0, 1.0 // bottom left ]);Z this.gl.uniformMatrix4fv(this.shaderPrograms.square.mvMatrixUniform, false, this.camera);% var buffer = this.gl.createBuffer();2 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);G this.gl.bufferData(this.gl.ARRAY_BUFFER, coords, this.gl.STATIC_DRAW); this.gl.vertexAttribPointer(this.shaderPrograms.square.vertexPositionAttribute, 3, this.gl.FLOAT, false, coords.BYTES_PER_ELEMENT * 7, 0);U this.gl.enableVertexAttribArray(this.shaderPrograms.square.vertexPositionAttribute); this.gl.vertexAttribPointer(this.shaderPrograms.square.vertexColorAttribute, 4, this.gl.FLOAT, false, coords.BYTES_PER_ELEMENT * 7, coords.BYTES_PER_ELEMENT * 3);R this.gl.enableVertexAttribArray(this.shaderPrograms.square.vertexColorAttribute);- this.gl.drawArrays(this.gl.LINE_LOOP, 0, 4);};8Renderer.prototype.beginSprites = function(numSprites) { this.useProgram("sprite"); var size = numSprites * 30;J if (this.spriteCoords === undefined || size > this.spriteCoords.length) {8 this.spriteCoords = new Float32Array(numSprites * 30); } this.currSprite = 0;};=Renderer.prototype.addSprite = function(name, x, y, dw, dh) {! var sprite = this.sprites[name]; if (!sprite) { return; }# this.currTexture = sprite.texture; dw = dw || sprite.width; dh = dh || sprite.height; this.spriteCoords.set([T x + dw, y, 0.0, sprite.textureCoords.right, sprite.textureCoords.top, // top rightM x, y, 0.0, sprite.textureCoords.left, sprite.textureCoords.top, // top left_ x + dw, y + dh, 0.0, sprite.textureCoords.right, sprite.textureCoords.bottom, // bottom rightM x, y, 0.0, sprite.textureCoords.left, sprite.textureCoords.top, // top left_ x + dw, y + dh, 0.0, sprite.textureCoords.right, sprite.textureCoords.bottom, // bottom rightW x, y + dh, 0.0, sprite.textureCoords.left, sprite.textureCoords.bottom // bottom left ], this.currSprite * 30); this.currSprite++;};'Renderer.prototype.flush = function() {) this.gl.activeTexture(this.gl.TEXTURE0);; this.gl.bindTexture(this.gl.TEXTURE_2D, this.currTexture);A this.gl.uniform1i(this.shaderPrograms.sprite.samplerUniform, 0);Z this.gl.uniformMatrix4fv(this.shaderPrograms.sprite.mvMatrixUniform, false, this.camera);% var buffer = this.gl.createBuffer();2 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);R this.gl.bufferData(this.gl.ARRAY_BUFFER, this.spriteCoords, this.gl.STATIC_DRAW); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);U this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.vertexPositionAttribute); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);S this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.textureCoordAttribute);? this.gl.drawArrays(this.gl.TRIANGLES, 0, this.currSprite * 6); delete this.currSprite; delete this.currTexture;};module.exports = Renderer;5_|(V)VUR5_}(V)VUU5_}(V)VUV 5_}(V)VUZ 5_(V)VUt 5_(V)VU s[name].textureIndex = i;5_(V)VU s[name].textureIndex = i;5_(V)VU! s[name].textureIndex = i;5_(V)VU });5_(V)VU });5_(V)VU });5_(V)VUA" s[name].textureIndex = i;5_X(V)VUB[ this.sprites = object.values(textureManifests).reduce(function(sprites, textureManifest) {5_a7(V)V[acab5_b(V)V[ac8 this.spriteCoords = new Float32Array(numSprites * 30);5_b(V)V[ac5 this.arraySize = new Float32Array(numSprites * 30);5_b(V)V[ac1 this.arraySize = Float32Array(numSprites * 30);5_b(V)V[ac% this.arraySize = (numSprites * 30);5_b"(V)V[Cac$ this.arraySize = numSprites * 30);5_a"(V)V[acab5_b(V)V[Dac8 this.spriteCoords = new Float32Array(numSprites * 30);5_p(V)V[qsqsqsps pr5_r(V)V[qs rs5_r%(V)V[rurtrtqt% this.spriteCoords[sprite.texture]5_v(V)V\Bvy vx5_w(V)V\[wy wy5_z(V)V\ey{ this.spriteCoords.set([5_x(V)V\hwx c.set(5_x(V)V\twy c.set([5_ (V)V\ ], this.currSprite * 30);5_(V)V\ 5_(V)V\ c.index++;5_(V)V\ c.index++;5_(V)V\ this.currSprite++;5_w(V)V\vx, var c = this.spriteCoords[sprite.texture];wx5_v(V)V\uw }vw5_u(V)V\tv };uv5_u(V)V\tv };uv5_t(V)V\su/ coords: new Float32Array(this.arraySize);tu5_t(V)V\su0 coords: new Float32Array(this.arraySize);tu5_s(V)V\rt index: 0,st5_s(V)V\rt index: 0,st5_r(V)V\qs) this.spriteCoords[sprite.texture] = {rs5_r(V)V\qs* this.spriteCoords[sprite.texture] = {rs5_q(V)V\pr8 if (this.spriteCoords[sprite.texture] === undefined) {qr5_q(V)V\pr9 if (this.spriteCoords[sprite.texture] === undefined) {5_r(V)V\qs+ this.spriteCoords[sprite.texture] = {5_s(V)V\rt index: 0,5_t(V)V\su1 coords: new Float32Array(this.arraySize);5_u(V)V\tv };5_v(V)V\uw }5_w(V)V\vx- var c = this.spriteCoords[sprite.texture];5_t(V)V\su+ coords: new Float32Array(this.arraySize);tu5_s(V)V\rt index: 0,st5_l(V)V]9kl# this.currTexture = sprite.texture;5_(V)V]\5_(V)V]^ 5_(V)V]~5_(V)V]5_(V)V] 5_(V)V]+ var c = this.spriteCoords[sprite.texture];5_(V)V] });5_(V)V]. var c = this.spriteCoords[sprite.texture];5_(V)V]( var c = this.spriteCoords[.texture];5_ (V)V]Z this.gl.uniformMatrix4fv(this.shaderPrograms.sprite.mvMatrixUniform, false, this.camera);5_  (V)V]5_   VV]) this.gl.activeTexture(this.gl.TEXTURE0);; this.gl.bindTexture(this.gl.TEXTURE_2D, this.currTexture);A this.gl.uniform1i(this.shaderPrograms.sprite.samplerUniform, 0);% var buffer = this.gl.createBuffer();2 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);R this.gl.bufferData(this.gl.ARRAY_BUFFER, this.spriteCoords, this.gl.STATIC_DRAW); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);U this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.vertexPositionAttribute); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);S this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.textureCoordAttribute);? this.gl.drawArrays(this.gl.TRIANGLES, 0, this.currSprite * 6);5_    VV]5_  VV]) this.gl.activeTexture(this.gl.TEXTURE0);; this.gl.bindTexture(this.gl.TEXTURE_2D, this.currTexture);A this.gl.uniform1i(this.shaderPrograms.sprite.samplerUniform, 0);% var buffer = this.gl.createBuffer();2 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);R this.gl.bufferData(this.gl.ARRAY_BUFFER, this.spriteCoords, this.gl.STATIC_DRAW); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);U this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.vertexPositionAttribute); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);S this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.textureCoordAttribute);? this.gl.drawArrays(this.gl.TRIANGLES, 0, this.currSprite * 6);5_ ,VV]> this.gl.bindTexture(this.gl.TEXTURE_2D, this.currTexture);5_-VV^U this.gl.bufferData(this.gl.ARRAY_BUFFER, this.spriteCoords, this.gl.STATIC_DRAW);5_mVV^  this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);5_nVV^' this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, c.Coords.BYTES_PER_ELEMENT * 5, 0);5_oVV^) this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, c.Coords.BYTES_PER_ELEMENT * 5, 0);5_kVV^F this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_VV^^ this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_-VV^B this.gl.drawArrays(this.gl.TRIANGLES, 0, this.currSprite * 6);5_aVV^`a8 this.spriteCoords = new Float32Array(numSprites * 30);5_VV^5_ VV^E delete this.currTexture;5_VV^F5_r+VV^Gqs, coords: new Float32Array(this.arraySize);5_ V_< Object.keys(this.spriteCoords).forEach(function(texture) {5_! V_' var c = this.spriteCoords[texture];5_ "!V_, this.gl.activeTexture(this.gl.TEXTURE0);5_!#"V_5 this.gl.bindTexture(this.gl.TEXTURE_2D, texture);5_"&#V_D this.gl.uniform1i(this.shaderPrograms.sprite.samplerUniform, 0);5_#'$&V_( var buffer = this.gl.createBuffer();5_&('V_5 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);5_')(V_L this.gl.bufferData(this.gl.ARRAY_BUFFER, c.coords, this.gl.STATIC_DRAW);5_(*)V_ this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, 0);5_)+*V_X this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.vertexPositionAttribute);5_*,+V_ this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, c.coords.BYTES_PER_ELEMENT * 3);5_+-,V_V this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.textureCoordAttribute);5_,.-V_: this.gl.drawArrays(this.gl.TRIANGLES, 0, c.index * 6);5_-/.V_  }.bind(this));5_.0/V_"; this.gl.drawArrays(this.gl.TRIANGLES, 0, c.index * 6);5_/20V_#W this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.textureCoordAttribute);5_0312V_% this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, c.coords.BYTES_PER_ELEMENT * 3);5_243V_(Y this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.vertexPositionAttribute);5_354V_) this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, 0);5_465V_*M this.gl.bufferData(this.gl.ARRAY_BUFFER, c.coords, this.gl.STATIC_DRAW);5_576V_+6 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);5_687V_+) var buffer = this.gl.createBuffer();5_798V_,E this.gl.uniform1i(this.shaderPrograms.sprite.samplerUniform, 0);5_8:9V_,6 this.gl.bindTexture(this.gl.TEXTURE_2D, texture);5_9;:V_-- this.gl.activeTexture(this.gl.TEXTURE0);5_:<;V_-( var c = this.spriteCoords[texture];5_;=<V_/= Object.keys(this.spriteCoords).forEach(function(texture) {5_<>=V_0) var c = this.spriteCoords[texture];5_=?>V_1. this.gl.activeTexture(this.gl.TEXTURE0);5_>@?V_17 this.gl.bindTexture(this.gl.TEXTURE_2D, texture);5_?A@V_1F this.gl.uniform1i(this.shaderPrograms.sprite.samplerUniform, 0);5_@BAV_2* var buffer = this.gl.createBuffer();5_ACBV_37 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);5_BDCV_3N this.gl.bufferData(this.gl.ARRAY_BUFFER, c.coords, this.gl.STATIC_DRAW);5_CEDV_4 this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, 0);5_DFEV_5Z this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.vertexPositionAttribute);5_EGFV_6 this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, c.coords.BYTES_PER_ELEMENT * 3);5_FHGV_6X this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.textureCoordAttribute);5_GIHV_8< this.gl.drawArrays(this.gl.TRIANGLES, 0, c.index * 6);5_HIV_<H }.bind(this));5_021V_$ 5_#%&$V_ 5_$%V_) var buffer = this.gl.createBuffer();5_V_; Object.keys(this.spriteCoords).forEach(function(texture) {& var c = this.spriteCoords[texture];+ this.gl.activeTexture(this.gl.TEXTURE0);4 this.gl.bindTexture(this.gl.TEXTURE_2D, texture);C this.gl.uniform1i(this.shaderPrograms.sprite.samplerUniform, 0);' var buffer = this.gl.createBuffer();4 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);K this.gl.bufferData(this.gl.ARRAY_BUFFER, c.coords, this.gl.STATIC_DRAW); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, 0);W this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.vertexPositionAttribute); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, c.coords.BYTES_PER_ELEMENT * 3);U this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.textureCoordAttribute);9 this.gl.drawArrays(this.gl.TRIANGLES, 0, c.index * 6); }.bind(this));< Object.keys(this.spriteCoords).forEach(function(texture) {5_V_ ' var c = this.spriteCoords[texture];, this.gl.activeTexture(this.gl.TEXTURE0);5 this.gl.bindTexture(this.gl.TEXTURE_2D, texture);D this.gl.uniform1i(this.shaderPrograms.sprite.samplerUniform, 0); ( var buffer = this.gl.createBuffer();5 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);L this.gl.bufferData(this.gl.ARRAY_BUFFER, c.coords, this.gl.STATIC_DRAW); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, 0);X this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.vertexPositionAttribute); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, c.coords.BYTES_PER_ELEMENT * 5, c.coords.BYTES_PER_ELEMENT * 3);V this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.textureCoordAttribute); : this.gl.drawArrays(this.gl.TRIANGLES, 0, c.index * 6); }.bind(this));  delete this.currSprite;5_VV^ }.bind(this));5_kVV^C this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, This.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_   VV]) this.gl.activeTexture(this.gl.TEXTURE0);; this.gl.bindTexture(this.gl.TEXTURE_2D, this.currTexture);A this.gl.uniform1i(this.shaderPrograms.sprite.samplerUniform, 0);% var buffer = this.gl.createBuffer();2 this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);R this.gl.bufferData(this.gl.ARRAY_BUFFER, this.spriteCoords, this.gl.STATIC_DRAW); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);U this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.vertexPositionAttribute); this.gl.vertexAttribPointer(this.shaderPrograms.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);S this.gl.enableVertexAttribArray(this.shaderPrograms.sprite.textureCoordAttribute);? this.gl.drawArrays(this.gl.TRIANGLES, 0, this.currSprite * 6);5_(V)V]V  (5_l(V)V]8kn5_v(V)V\uw }5_(V)V\ .currSprite++;5_a7(V)V[ab ac this.5_(V)VU* Object.keys(s).forEach(fu nction(name) {5_(V)VU; var s = textures.toSprites (this.gl, t, textureManifest);5_}(V)VUJ5_{}(V)VTR{|{|5_{}(V)VTV{|z| 5_{}(V)VTX@z| console.log(this.currTexture);5_y}(V)VTLyz y{5_y|(V)VP?xz> // this.gl.bindTexture(this.gl.TEXTURE_2D, this.currTexture);5_Rj}(V)V QS this.gl.vertexAttribPointer(this.shaderPrograms.square.vertexPositionAttribute, 3, this.gl.FLOAT, false, w.spriteCoords.BYTES_PER_ELEMENT * 7, 0);5_H`fVV GI& x, y, 0.0, ,0.0, 1.0, , // top left5_J`fVV pIKQ x, y + dh, 0.0, .textureCoords.left, sprite.textureCoords.bottom // bottom left5_H ciVV aGIG x, y, 0.0, .textureCoords.left, sprite.textureCoords.top, // top left5_GdjVV ^GH5_sutFIIVKEG|8 this.spriteCoords = new Float32Array(numSprites * 30);5_IK^Jb%%%VVacv@ this.gl.uniform1i(this.shaderProgram.sprite.samplerUniform, 0);5_JLKd,%%VVcevY this.gl.uniformMatrix4fv(this.shaderProgram.sprite.mvMatrixUniform, false, this.camera);5_KMLj/%%VVikv this.gl.vertexAttribPointer(this.shaderProgram.sprite.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);5_LNMk3%%VVjlvT this.gl.enableVertexAttribArray(this.shaderProgram.sprite.vertexPositionAttribute);5_MONm/%%VVlnv this.gl.vertexAttribPointer(this.shaderProgram.sprite.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_NPOn3%%VVmovR this.gl.enableVertexAttribArray(this.shaderProgram.sprite.textureCoordAttribute);5_OQPn4%%VVmovL this.gl.enableVertexAttribArray(this.shaderProgram..textureCoordAttribute);5_PRQn4%%VVmovK this.gl.enableVertexAttribArray(this.shaderProgram.textureCoordAttribute);5_QSR2-%%VV13vN this.gl.uniformMatrix4fv(this.shaderProgram..pMatrixUniform, false, pMatrix);5_RTS2-%%VV13vM this.gl.uniformMatrix4fv(this.shaderProgram.pMatrixUniform, false, pMatrix);5_SUTb&%%VVacv: this.gl.uniform1i(this.shaderProgram..samplerUniform, 0);5_TVUb&%%VVacv9 this.gl.uniform1i(this.shaderProgram.samplerUniform, 0);5_UWVd-%%VVcevS this.gl.uniformMatrix4fv(this.shaderProgram..mvMatrixUniform, false, this.camera);5_VXWd-%%VVcevR this.gl.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform, false, this.camera);5_WYXj0%%VV ikv this.gl.vertexAttribPointer(this.shaderProgram..vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);5_XZYj0%%VV ikv this.gl.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);5_Y[Zk4%%VV jlvN this.gl.enableVertexAttribArray(this.shaderProgram..vertexPositionAttribute);5_Z\[k4%%VV jlvM this.gl.enableVertexAttribArray(this.shaderProgram.vertexPositionAttribute);5_[]\m0%%VV lnv this.gl.vertexAttribPointer(this.shaderProgram..textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_\]m0%%VV /lnv this.gl.vertexAttribPointer(this.shaderProgram.textureCoordAttribute, 2, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, this.spriteCoords.BYTES_PER_ELEMENT * 3);5_FHG)%%VV)*v(*v 5_CDFEu%%VVuvtuu5_CED(%%VV()u (*v this.5_8:9*%%VVt*+t5_#%$+,%%VV*,qj this.gl.uniformMatrix4fv(this.shaderProgramthis.shaderPrograms = .sprite.pMatrixUniform, false, pMatrix);5_!#"3&&VVq r this.5_# " V V#$v#$vu this.shaderProgram = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_$ " V V#%wx this.shaderProgram = shaders.link(this.gl, compiled, shaderManifest.vertexAttribArrays, shaderManifest.uniformVars);5_# " V V"$5_VSm n var progr5_TooVVۉSU7 this.spriteCoords = new Float32Array(numSprites * 30);5_R mmVVURSQS var size numSprites * 30=5_QmmVVBQR QS var si5_lllVVזkp5_tDRSVV}st5_t/RSVVqtusu] gl.enableVertexAttribArray(this.shaderProgram.textureCoordAttributevertexPositionAttribute);5_rRSVVYrsrsH gl.enableVertexAttribArray(this.shaderProgram.vertexPositionAttribute);5_pRSVVDpqoq taddhis.gl.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute, 3, this.gl.FLOAT, false, this.spriteCoords.BYTES_PER_ELEMENT * 5, 0);5_RooVVQTL this.spriteCoords = new Float32Array(numSprites * 30); this.currSprite = 0;5_CppVVӐBD< // mat4.translate(this.mvMatrix, this.camera, [x, y, 0.0]);5_DJppVVӓCER this.gl.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform, false, this.camera);5_prqja"a'v)Vikw(Renderer.prototype.flusth = function() {5_OQPgmpVV8ghufhu ], this.currSprite * 30);5_+-,R156V#VgQSnI this.spriteCoords = new Float32Array(numSprites, this.currSprite * 30);5_&')([56V#V[\j[\j dw = dw || sprite.width; dh = dh || sprite.height;5_&('[56V#Vʛ[\j[\j dw = dw || sprite.width; dh = dh || sprite.height;5_"S06VVpSTiSTi this.currSprite = 0;5_ S06VVyRTj this.currSpriteIndex = 0;5_! T06VVzSU5_ !U06VV|UViUVi this.currSprite = 0;5_Q? F V VQR^QR^) this.gl.activeTexture(this.gl.TEXTURE0);9 this.gl.bindTexture(this.gl.TEXTURE_2D, sprite.texture);9 this.gl.uniform1i(this.shaderProgram.samplerUniform, 0);9 mat4.translate(this.mvMatrix, this.camera, [x, y, 0.0]);T this.gl.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform, false, this.mvMatrix);F this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, vertexCoords.numItems);5_ QVQR] QS^ {5_ O'VNP\4Renderer.prototype.fillRect = function(x, y, w, h) {5_OV"OP[OP[>Renderer.prototype.drawSprite = function(name, x, y, dw, dh) {5