function parseXml(gl) { loadObjXml(gl, "./xml/effect.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/boss.xml");//gl.bossにxmlファイルの中身を入れる loadObjXml(gl, "./xml/titlefont.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_pushstart.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_superdandy.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_0.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_1.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_2.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_3.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_4.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_5.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_6.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_7.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_8.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_9.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_hige.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_1997yas_k.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml/font_gameover.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml2/bullets.xml");//gl.objにxmlファイルの中身をいれる loadObjXml(gl, "./xml2/enemy.xml");//gl.objにxmlファイルの中身を入れる loadObjXml(gl, "./xml2/player.xml");//gl.objにxmlファイルの中身を入れる loadObjXml(gl, "./xml2/redbomb_anim.xml");//gl.objにxmlファイルの中身を入れる loadObjXml(gl, "./xml2/boss1.xml");//gl.objにxmlファイルの中身を入れる loadObjXml(gl, "./xml2/boss2.xml");//gl.objにxmlファイルの中身を入れる jiki = new makePlayer(gl.obj);//自機の情報をいれておくクラス、グローバル gamesyokika(); enemy = [];//敵の情報を入れておく配列を用意、グローバル pushEnemy(gl,enemy);//配列enemy[]に敵をpush // pushEnemyBullets(gl, enemy);//配列enemy[]に敵の弾情報をpush boss = [];//bossの情報を入れておく配列を用意,グローバル pushBoss(gl, boss);//配列boss[]にbossの情報をpush bullets = [];//弾の情報を入れておく配列を用意、グローバル pushPlayerBullets(gl,bullets);//配列bullets[]に弾をpush bomImage = [];//撃破時の爆発の情報をいれておく配列を用意。グローバル pushBom(gl, bomImage);//配列 bom[]に爆発をpush font = [];//fontを入れておく配列 pushFont(gl, font);// // ebullets = [];//敵の弾の情報を入れておく配列を用意、グローバル // pushEnemyBullets(gl, ebullets); } function loadObjXml(gl,url) { if(gl.obj == undefined) gl.obj = new Object(); var xmlChara = new Object(); xmlChara = parsePanel(url); for (var name in xmlChara) { gl.obj[name] = makeXmlObj(gl, xmlChara[name]); gl.obj[name].texture = loadImageTexture(gl, xmlChara[name].image); } } function pushBoss(gl, boss) { boss.push(gl.obj["blackhole"]); boss.push(gl.obj["boss_orgun"]);//透過ずみ boss.push(gl.obj["boss2_dummy"]); boss.push(gl.obj["boss2_rightpalm"]); boss.push(gl.obj["boss2_lefthand"]); boss.push(gl.obj["boss2_left_s_gird"]); boss.push(gl.obj["boss3_body"]); boss.push(gl.obj["boss_4"]); boss.push(gl.obj["boss_corpse"]); boss.push(gl.obj["boss2_righthand"]); boss.push(gl.obj["boss2_openbattery"]); boss.push(gl.obj["boss2_rightarm_b"]); boss.push(gl.obj["boss2_leftpalm"]); boss.push(gl.obj["boss2_leftarm"]);//以下透過ずみ boss.push(gl.obj["boss2_rightarm"]); boss.push(gl.obj["boss2_leftshoulder"]); boss.push(gl.obj["boss2_left_s_up"]); boss.push(gl.obj["boss2_battery"]); boss.push(gl.obj["boss2_brokenhatch"]); boss.push(gl.obj["boss2_leftbattery"]); boss.push(gl.obj["boss2_r_shoulderup"]); boss.push(gl.obj["boss2_body"]); boss.push(gl.obj["boss2_rightshoulder"]); } function pushEnemy(gl, enemy) { enemy.push(gl.obj["missile"]); enemy.push(gl.obj["enemy_greencrab"]); enemy.push(gl.obj["enemy_plane"]); enemy.push(gl.obj["gunbattery"]); enemy.push(gl.obj["enemy_redbullet"]); enemy.push(gl.obj["enemy_bluebullet"]); enemy.push(gl.obj["tama_s_01"]); enemy.push(gl.obj["tama_s_02"]); enemy.push(gl.obj["tama_s_03"]); enemy.push(gl.obj["meteo"]); enemy.push(gl.obj["tama_l_02"]); enemy.push(gl.obj["tama_l_03"]); enemy.push(gl.obj["enemy_lightning"]); enemy.push(gl.obj["enemy_lasersplosh.001"]); enemy.push(gl.obj["enemy_lasersplosh.002"]); enemy.push(gl.obj["enemy_lasersplosh.003"]); enemy.push(gl.obj["missile"]); enemy.push(gl.obj["spacefish"]); enemy.push(gl.obj["tama_s_04"]); } function pushPlayerBullets(gl,bullets) { bullets.push(gl.obj["bluebarrier"]); bullets.push(gl.obj["lockon_sight"]); bullets.push(gl.obj["bulebullet_right"]); bullets.push(gl.obj["bulebullet_left"]); bullets.push(gl.obj["redbullet"]); bullets.push(gl.obj["greenbullet"]); bullets.push(gl.obj["lonlaser"]); } function pushBom(gl, bomImage) { bomImage.push(gl.obj["redbomb_anim_0"]); bomImage.push(gl.obj["redbomb_anim_1"]); bomImage.push(gl.obj["redbomb_anim_2"]); bomImage.push(gl.obj["redbomb_anim_3"]); bomImage.push(gl.obj["redbomb_anim_4"]); bomImage.push(gl.obj["redbomb_anim_5"]); bomImage.push(gl.obj["redbomb_anim_6"]); bomImage.push(gl.obj["redbomb_anim_7"]); } function pushEnemyBullets(gl, ebullets) { ebullets.push(gl.obj["enemy_redbullet"]); ebullets.push(gl.obj["enemy_bluebullet"]); ebullets.push(gl.obj["tama_s_01"]); ebullets.push(gl.obj["tama_s_02"]); ebullets.push(gl.obj["tama_s_03"]); ebullets.push(gl.obj["tama_s_04"]); ebullets.push(gl.obj["tama_l_02"]); ebullets.push(gl.obj["tama_l_03"]); ebullets.push(gl.obj["tama_l_04"]); } function pushFont(gl, font) { font.push(gl.obj["font_0"]); font.push(gl.obj["font_1"]); font.push(gl.obj["font_2"]); font.push(gl.obj["font_3"]); font.push(gl.obj["font_4"]); font.push(gl.obj["font_5"]); font.push(gl.obj["font_6"]); font.push(gl.obj["font_7"]); font.push(gl.obj["font_8"]); font.push(gl.obj["font_9"]) font.push(gl.obj["titlefont"]); font.push(gl.obj["font_pushstart"]); font.push(gl.obj["font_superdandy"]); font.push(gl.obj["font_hige"]); font.push(gl.obj["font_font_1997yas_k"]); font.push(gl.obj["font_gameover"]); } function PutSpriteF(ctx, x, y, scale, glObj) { // setup VBOs ctx.enableVertexAttribArray(0); ctx.enableVertexAttribArray(1); ctx.enableVertexAttribArray(2); ctx.bindBuffer(ctx.ARRAY_BUFFER, glObj.vertexObject); ctx.vertexAttribPointer(2, 3, ctx.FLOAT, false, 0, 0); ctx.bindBuffer(ctx.ARRAY_BUFFER, glObj.normalObject); ctx.vertexAttribPointer(0, 3, ctx.FLOAT, false, 0, 0); ctx.bindBuffer(ctx.ARRAY_BUFFER, glObj.texCoordObject); ctx.vertexAttribPointer(1, 2, ctx.FLOAT, false, 0, 0); ctx.bindBuffer(ctx.ELEMENT_ARRAY_BUFFER, glObj.indexObject); // generate the model-view matrix var mvMatrix = new J3DIMatrix4(); mvMatrix.scale(scale, scale, scale); mvMatrix.translate( x, y, 10); // construct the normal matrix from the model-view matrix var normalMatrix = new J3DIMatrix4(mvMatrix); normalMatrix.invert(); normalMatrix.transpose(); normalMatrix.setUniform(ctx, ctx.getUniformLocation(ctx.program, "u_normalMatrix"), false); // construct the model-view * projection matrix var mvpMatrix = new J3DIMatrix4(ctx.perspectiveMatrix); mvpMatrix.multiply(mvMatrix); mvpMatrix.setUniform(ctx, ctx.getUniformLocation(ctx.program, "u_modelViewProjMatrix"), false); ctx.bindTexture(ctx.TEXTURE_2D, glObj.texture); ctx.drawElements(ctx.TRIANGLES, glObj.numIndices, ctx.UNSIGNED_SHORT, 0); } function PutSpriteA(ctx, x, y, scale, angle, glObj) { // setup VBOs ctx.enableVertexAttribArray(0); ctx.enableVertexAttribArray(1); ctx.enableVertexAttribArray(2); ctx.bindBuffer(ctx.ARRAY_BUFFER, glObj.vertexObject); ctx.vertexAttribPointer(2, 3, ctx.FLOAT, false, 0, 0); ctx.bindBuffer(ctx.ARRAY_BUFFER, glObj.normalObject); ctx.vertexAttribPointer(0, 3, ctx.FLOAT, false, 0, 0); ctx.bindBuffer(ctx.ARRAY_BUFFER, glObj.texCoordObject); ctx.vertexAttribPointer(1, 2, ctx.FLOAT, false, 0, 0); ctx.bindBuffer(ctx.ELEMENT_ARRAY_BUFFER, glObj.indexObject); // generate the model-view matrix var mvMatrix = new J3DIMatrix4(); mvMatrix.scale(scale, scale, scale); mvMatrix.translate( x, y, 10); mvMatrix.rotate(angle, 0, 0, 1); // construct the normal matrix from the model-view matrix var normalMatrix = new J3DIMatrix4(mvMatrix); normalMatrix.invert(); normalMatrix.transpose(); normalMatrix.setUniform(ctx, ctx.getUniformLocation(ctx.program, "u_normalMatrix"), false); // construct the model-view * projection matrix var mvpMatrix = new J3DIMatrix4(ctx.perspectiveMatrix); mvpMatrix.multiply(mvMatrix); mvpMatrix.setUniform(ctx, ctx.getUniformLocation(ctx.program, "u_modelViewProjMatrix"), false); ctx.bindTexture(ctx.TEXTURE_2D, glObj.texture); ctx.drawElements(ctx.TRIANGLES, glObj.numIndices, ctx.UNSIGNED_SHORT, 0); }