changeset 23:1f234cbb53f1

update Lockon Sight
author NOBUYASU Oshiro
date Sun, 24 Oct 2010 20:08:14 +0900
parents 222c5c84325a
children 7c1ff1927da3
files webGL/dandy/dandy5.html webGL/dandy/resources/parse.js webGL/dandy/resources/parse.js~
diffstat 3 files changed, 135 insertions(+), 190 deletions(-) [+]
line wrap: on
line diff
--- a/webGL/dandy/dandy5.html	Mon Oct 18 17:07:04 2010 +0900
+++ b/webGL/dandy/dandy5.html	Sun Oct 24 20:08:14 2010 +0900
@@ -1,32 +1,8 @@
 <!DOCTYPE html> 
-<!--
- /*
- * Copyright (C) 2009 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
- --> 
+
 <html> 
 	<head> 
+		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
 		<title>WebGL dandy</title> 
 		<script src="resources/J3DI.js"> </script>    
 		<script src="resources/J3DIMath.js"> </script>
--- a/webGL/dandy/resources/parse.js	Mon Oct 18 17:07:04 2010 +0900
+++ b/webGL/dandy/resources/parse.js	Sun Oct 24 20:08:14 2010 +0900
@@ -206,7 +206,7 @@
     // 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);
+    mvpMatrix.setUniform(ctx, ctx.getUniformLocation(ctx.program, "u_modelViewProjMatrix"), false);
 
     
     ctx.bindTexture(ctx.TEXTURE_2D, glObj.texture);
@@ -236,8 +236,8 @@
     // 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);
-    mvMatrix.translate( x, y, 10);
     
     // construct the normal matrix from the model-view matrix
     var normalMatrix = new J3DIMatrix4(mvMatrix);
@@ -247,8 +247,8 @@
     normalMatrix.setUniform(ctx, ctx.getUniformLocation(ctx.program, "u_normalMatrix"), false);
     
     // construct the model-view * projection matrix
-    var mvpMatrix = new J3DIMatrix4(mvMatrix);
-    mvpMatrix.multiply(ctx.perspectiveMatrix);
+    var mvpMatrix = new J3DIMatrix4(ctx.perspectiveMatrix);
+    mvpMatrix.multiply(mvMatrix);
 //    ctx.uniformMatrix4fv(ctx.getUniformLocation(ctx.program, "u_modelViewProjMatrix"), false, mvpMatrix.getAsFloat32Array());
      mvpMatrix.setUniform(ctx, ctx.getUniformLocation(ctx.program, "u_modelViewProjMatrix"), false);
 
--- a/webGL/dandy/resources/parse.js~	Mon Oct 18 17:07:04 2010 +0900
+++ b/webGL/dandy/resources/parse.js~	Sun Oct 24 20:08:14 2010 +0900
@@ -1,39 +1,34 @@
 function parseXml(gl)
 {
-
-    //    loadCharaXml(gl, "./xml/character.xml");//gl.charaにxmlファイルの中身を入れる
+    loadObjXml(gl, "./xml/effect.xml");//gl.objにxmlファイルの中身をいれる
 
-    loadEffectXml(gl, "./xml/effect.xml");//gl.effectにxmlファイルの中身をいれる
-
-
-    loadCharaXml(gl, "./xml/boss.xml");//gl.bossにxmlファイルの中身を入れる
+    loadObjXml(gl, "./xml/boss.xml");//gl.bossにxmlファイルの中身を入れる
 
-    loadCharaXml(gl, "./xml/titlefont.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_pushstart.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_superdandy.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_0.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_1.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_2.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_3.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_4.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_5.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_6.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_7.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_8.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_9.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_hige.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_1997yas_k.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml/font_gameover.xml");//gl.effectに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ファイルの中身をいれる
 
-    loadEffectXml(gl, "./xml2/bullets.xml");//gl.effectにxmlファイルの中身をいれる
-    loadCharaXml(gl, "./xml2/enemy.xml");//gl.charaにxmlファイルの中身を入れる
-    loadCharaXml(gl, "./xml2/player.xml");//gl.charaにxmlファイルの中身を入れる
-    loadEffectXml(gl, "./xml2/redbomb_anim.xml");//gl.charaにxmlファイルの中身を入れる
-    loadCharaXml(gl, "./xml2/boss1.xml");//gl.charaにxmlファイルの中身を入れる
-    loadCharaXml(gl, "./xml2/boss2.xml");//gl.charaに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.chara);//自機の情報をいれておくクラス、グローバル
+    jiki = new makePlayer(gl.obj);//自機の情報をいれておくクラス、グローバル
 
     gamesyokika();
     
@@ -57,156 +52,126 @@
 }
 
 
-
-function loadCharaXml(gl,url)
+function loadObjXml(gl,url)
 {
-    if(gl.chara == undefined) gl.chara = new Object();
+    if(gl.obj == undefined) gl.obj = new Object();
     var xmlChara = new Object();
     xmlChara = parsePanel(url);
     for (var name in xmlChara)
 	{
-            gl.chara[name] = makeXmlObj(gl, xmlChara[name]);
-            gl.chara[name].texture = loadImageTexture(gl, xmlChara[name].image);
+            gl.obj[name] = makeXmlObj(gl, xmlChara[name]);
+            gl.obj[name].texture = loadImageTexture(gl, xmlChara[name].image);
 	}
 }
 
-function loadEffectXml(gl,url)
-{
-    if(gl.effect == undefined)gl.effect = new Object();
-    var xmlChara = new Object();
-    xmlChara = parsePanel(url);
-    for (var name in xmlChara)
-        {
-            gl.effect[name] = makeXmlObj(gl, xmlChara[name]);
-            gl.effect[name].texture = loadImageTexture(gl, xmlChara[name].image);
-        }
-}
-
-function loadBossXml(gl,url)
-{
-    if(gl.boss == undefined)gl.boss = new Object();
-    var xmlChara = new Object();
-    xmlChara = parsePanel(url);
-    for (var name in xmlChara)
-        {
-            gl.boss[name] = makeXmlObj(gl, xmlChara[name]);
-            gl.boss[name].texture = loadImageTexture(gl, xmlChara[name].image);
-        }
-}
-
 function pushBoss(gl, boss)
 {
-    /*
-    for(var name in gl.boss)
-        {
-            boss.push(gl.boss[name]);
-        }
-    */
-    boss.push(gl.chara["blackhole"]);
-    boss.push(gl.chara["boss2_body"]);
-    boss.push(gl.chara["boss2_lefthand"]);
-    boss.push(gl.chara["boss2_rightshoulder"]);
-    boss.push(gl.chara["boss_orgun"]);
-    boss.push(gl.chara["boss2_left_s_gird"]);
-    boss.push(gl.chara["boss2_r_shoulderup"]);
-    boss.push(gl.chara["boss2_leftbattery"]);
-    boss.push(gl.chara["boss_corpse"]);
-    boss.push(gl.chara["boss_4"]);
-    boss.push(gl.chara["boss2_brokenhatch"]);
-    boss.push(gl.chara["boss2_righthand"]);
-    boss.push(gl.chara["boss2_openbattery"]);
-    boss.push(gl.chara["boss2_battery"]);
-    boss.push(gl.chara["boss2_rightarm_b"]);
-    boss.push(gl.chara["boss2_leftpalm"]);
-    boss.push(gl.chara["boss2_left_s_up"]);
-    boss.push(gl.chara["boss2_leftshoulder"]);
-    boss.push(gl.chara["boss3_body"]);
-    boss.push(gl.chara["boss2_leftarm"]);
-    boss.push(gl.chara["boss2_dummy"]);
-    boss.push(gl.chara["boss2_rightpalm"]);
-    boss.push(gl.chara["boss2_rightarm"]);
+
+    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.chara["missile"]);
-    enemy.push(gl.chara["enemy_greencrab"]);
-    enemy.push(gl.chara["enemy_plane"]);
-    enemy.push(gl.chara["gunbattery"]);
-    enemy.push(gl.effect["enemy_redbullet"]);
-    enemy.push(gl.effect["enemy_bluebullet"]);
-    enemy.push(gl.effect["tama_s_01"]);
-    enemy.push(gl.effect["tama_s_02"]);
-    enemy.push(gl.effect["tama_s_03"]);
-    enemy.push(gl.chara["meteo"]);
-    enemy.push(gl.effect["tama_l_02"]);
-    enemy.push(gl.effect["tama_l_03"]);
-    enemy.push(gl.chara["enemy_lightning"]);
-    enemy.push(gl.chara["enemy_lasersplosh.001"]);
-    enemy.push(gl.chara["enemy_lasersplosh.002"]);
-    enemy.push(gl.chara["enemy_lasersplosh.003"]);
-    enemy.push(gl.chara["missile"]);
-    enemy.push(gl.chara["spacefish"]);
-    enemy.push(gl.effect["tama_s_04"]);
+    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.effect["bluebarrier"]);
-    bullets.push(gl.effect["lockon_sight"]);
-    bullets.push(gl.effect["bulebullet_right"]);
-    bullets.push(gl.effect["bulebullet_left"]);
-    bullets.push(gl.effect["redbullet"]);
-    bullets.push(gl.effect["greenbullet"]);
-    bullets.push(gl.effect["lonlaser"]);
+    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.effect["redbomb_anim_0"]);
-    bomImage.push(gl.effect["redbomb_anim_1"]);
-    bomImage.push(gl.effect["redbomb_anim_2"]);
-    bomImage.push(gl.effect["redbomb_anim_3"]);
-    bomImage.push(gl.effect["redbomb_anim_4"]);
-    bomImage.push(gl.effect["redbomb_anim_5"]);
-    bomImage.push(gl.effect["redbomb_anim_6"]);
-    bomImage.push(gl.effect["redbomb_anim_7"]);
+    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.effect["enemy_redbullet"]);
-    ebullets.push(gl.effect["enemy_bluebullet"]);
-    ebullets.push(gl.effect["tama_s_01"]);
-    ebullets.push(gl.effect["tama_s_02"]);
-    ebullets.push(gl.effect["tama_s_03"]);
-    ebullets.push(gl.effect["tama_s_04"]);
-    ebullets.push(gl.effect["tama_l_02"]);
-    ebullets.push(gl.effect["tama_l_03"]);
-    ebullets.push(gl.effect["tama_l_04"]);
+    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.chara["font_0"]);
-    font.push(gl.chara["font_1"]);
-    font.push(gl.chara["font_2"]);
-    font.push(gl.chara["font_3"]);
-    font.push(gl.chara["font_4"]);
-    font.push(gl.chara["font_5"]);
-    font.push(gl.chara["font_6"]);
-    font.push(gl.chara["font_7"]);
-    font.push(gl.chara["font_8"]);
-    font.push(gl.chara["font_9"])
-    font.push(gl.chara["titlefont"]);
-    font.push(gl.chara["font_pushstart"]);
-    font.push(gl.chara["font_superdandy"]);
-    font.push(gl.chara["font_hige"]);
-    font.push(gl.chara["font_font_1997yas_k"]);
-    font.push(gl.chara["font_gameover"]);
+    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)
@@ -228,20 +193,21 @@
     ctx.bindBuffer(ctx.ELEMENT_ARRAY_BUFFER, glObj.indexObject);
 
     // generate the model-view matrix
-    var mvMatrix = new CanvasMatrix4();
+    var mvMatrix = new J3DIMatrix4();
+    mvMatrix.translate( x, y, 1);
     mvMatrix.scale(scale, scale, scale);
-    mvMatrix.translate( x, y, 10);
     
     // construct the normal matrix from the model-view matrix
-    var normalMatrix = new CanvasMatrix4(mvMatrix);
+    var normalMatrix = new J3DIMatrix4(mvMatrix);
     normalMatrix.invert();
     normalMatrix.transpose();
-    ctx.uniformMatrix4fv(ctx.getUniformLocation(ctx.program, "u_normalMatrix"), false, normalMatrix.getAsWebGLFloatArray());
+    normalMatrix.setUniform(ctx, ctx.getUniformLocation(ctx.program, "u_normalMatrix"), false);
     
     // construct the model-view * projection matrix
-    var mvpMatrix = new CanvasMatrix4(mvMatrix);
-    mvpMatrix.multRight(ctx.perspectiveMatrix);
-    ctx.uniformMatrix4fv(ctx.getUniformLocation(ctx.program, "u_modelViewProjMatrix"), false, mvpMatrix.getAsWebGLFloatArray());
+    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);
@@ -268,21 +234,24 @@
     ctx.bindBuffer(ctx.ELEMENT_ARRAY_BUFFER, glObj.indexObject);
 
     // generate the model-view matrix
-    var mvMatrix = new CanvasMatrix4();
+    var mvMatrix = new J3DIMatrix4();
     mvMatrix.scale(scale, scale, scale);
     mvMatrix.rotate(angle, 0, 0, 1);
     mvMatrix.translate( x, y, 10);
     
     // construct the normal matrix from the model-view matrix
-    var normalMatrix = new CanvasMatrix4(mvMatrix);
+    var normalMatrix = new J3DIMatrix4(mvMatrix);
     normalMatrix.invert();
     normalMatrix.transpose();
-    ctx.uniformMatrix4fv(ctx.getUniformLocation(ctx.program, "u_normalMatrix"), false, normalMatrix.getAsWebGLFloatArray());
+//    ctx.uniformMatrix4fv(ctx.getUniformLocation(ctx.program, "u_normalMatrix"), false, normalMatrix.getAsFloat32Array());
+    normalMatrix.setUniform(ctx, ctx.getUniformLocation(ctx.program, "u_normalMatrix"), false);
     
     // construct the model-view * projection matrix
-    var mvpMatrix = new CanvasMatrix4(mvMatrix);
-    mvpMatrix.multRight(ctx.perspectiveMatrix);
-    ctx.uniformMatrix4fv(ctx.getUniformLocation(ctx.program, "u_modelViewProjMatrix"), false, mvpMatrix.getAsWebGLFloatArray());
+    var mvpMatrix = new J3DIMatrix4(mvMatrix);
+    mvpMatrix.multiply(ctx.perspectiveMatrix);
+//    ctx.uniformMatrix4fv(ctx.getUniformLocation(ctx.program, "u_modelViewProjMatrix"), false, mvpMatrix.getAsFloat32Array());
+     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);