Show
Ignore:
Timestamp:
02/12/09 23:58:28 (4 years ago)
Author:
drry
Message:
  • fixed the scope of the variable i.
  • et cetera.
Location:
lang/javascript/jscloth/trunk
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/jscloth/trunk/cloth.js

    r29905 r29983  
    7373ClothApp.zsortCmp = function(t1, t2) { 
    7474        return t2.sortKey - t1.sortKey; 
    75 } 
     75}; 
    7676 
    7777ClothApp.prototype = { 
     
    134134                var nlen = this.mNodes.length; 
    135135                var i, nd; 
    136                 for(i = 0;i < nlen;i++) 
     136                for (i = 0;i < nlen;i++) 
    137137                { 
    138138                        nd = this.mNodes[i]; 
     
    151151                this.applyTension(); 
    152152 
    153                 for(i = 0;i < nlen;i++) 
     153                for (i = 0;i < nlen;i++) 
    154154                { 
    155155                        nd = this.mNodes[i]; 
     
    169169                var nlen = this.mNodes.length; 
    170170                var i, nd; 
    171                 for(i = 0;i < nlen;i++) 
     171                for (i = 0;i < nlen;i++) 
    172172                { 
    173173                        nd = this.mNodes[i]; 
     
    236236                                } 
    237237                        } 
    238                 }        
     238                } 
    239239        }, 
    240240 
     
    262262                var cols = 9; 
    263263                var rows = 8; 
    264                  
     264 
    265265                var step   = 22; 
    266266                this.mNLen = step*0.9; 
     
    316316                var nlen = this.mNodes.length; 
    317317 
    318                 for(i = 0;i < nlen;i++) 
     318                for (i = 0;i < nlen;i++) 
    319319                { 
    320320                        nd = this.mNodes[i]; 
     
    382382 
    383383                                t.poss[0] = new Vec3(ox + x*sz     , by, oz + y*sz + sz); 
    384                                 t.poss[1] = new Vec3(ox + x*sz + sz, by, oz + y*sz    ); 
     384                                t.poss[1] = new Vec3(ox + x*sz + sz, by, oz + y*sz     ); 
    385385                                t.poss[2] = new Vec3(ox + x*sz + sz, by, oz + y*sz + sz); 
    386386 
     
    467467                } 
    468468        } 
    469 } 
     469}; 
    470470 
    471471function ClothNode() 
     
    486486        this.poss  = new Array(3); 
    487487        this.tposs = [new Vec3(), new Vec3(), new Vec3()]; 
    488         this.uvs = [{u:0, v:0}, {u:0, v:0}, {u:0, v:0}]; 
     488        this.uvs   = [{u:0, v:0}, {u:0, v:0}, {u:0, v:0}]; 
    489489        this.shade = 0; 
    490490        this.lighting = true; 
  • lang/javascript/jscloth/trunk/index.html

    r29905 r29983  
    33<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> 
    44        <head> 
    5                 <meta name="viewport" content="width=480, user-scalable=no" />  
     5                <meta name="viewport" content="width=480, user-scalable=no" /> 
    66                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    77                <meta http-equiv="Content-Style-Type" content="text/css" /> 
     
    4242                <title>js cloth</title> 
    4343        </head> 
    44         <body onload="void( new ClothApp() );"> 
     44        <body onload="void new ClothApp();"> 
    4545                <div> 
    4646                        <canvas id="cv" width="480" height="300"></canvas> 
  • lang/javascript/jscloth/trunk/miku.html

    r29905 r29983  
    33<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> 
    44        <head> 
    5                 <meta name="viewport" content="width=480, user-scalable=no" />  
     5                <meta name="viewport" content="width=480, user-scalable=no" /> 
    66                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    77                <meta http-equiv="Content-Style-Type" content="text/css" /> 
     
    4343                <title>js miku</title> 
    4444        </head> 
    45         <body onload="void( new MikuApp() );"> 
     45        <body onload="void new MikuApp();"> 
    4646                <div> 
    4747                        <canvas id="cv" width="480" height="300"></canvas> 
  • lang/javascript/jscloth/trunk/miku.js

    r29905 r29983  
    122122                this.mTickCount++; 
    123123                var _this = this; 
    124                 setTimeout( function(){_this.onInterval();} , 20); 
     124                setTimeout(function(){_this.onInterval();}, 20); 
    125125        }, 
    126126 
     
    133133                mViewRot.transpose33(); 
    134134                var spos = [0,0,0,0]; 
    135                  
     135 
    136136                mViewRot.transVec3(spos, 0, 0, 5000); 
    137137                this.mAllMat.transVec3(spos, spos[0], -100, spos[2]); 
     
    202202                var p = new Vec3(); 
    203203                var pi = 0, ti = 0, spos = new Array(4); 
    204                  
     204 
    205205                var gi = 0, grest; 
    206206 
     
    209209                        model.enterGroupTransform(0); 
    210210 
     211                var i; 
    211212                for (i = 0;i < len;i++) { 
    212213                        p.x = poss[pi  ]; 
     
    291292                mesh.offset_applied = true; 
    292293        } 
    293 } 
     294}; 
    294295 
    295296function MikuModel(transformContext) 
     
    318319        enterGroupTransform: function(gi) { 
    319320                var w, t, u; 
    320                 switch(gi) { 
     321                switch (gi) { 
    321322                case 0: 
    322323                        { 
     
    373374        leaveGroupTransform: function(gi) { 
    374375        } 
    375 } 
     376}; 
    376377 
    377378var MESH_FLOOR = { 
     
    381382        poss: [ 
    382383                -120, -100, -120, 
    383                   0 , -100, -120, 
    384                 -120, -100,  0, 
    385                   0 , -100, 0, 
     384                0,    -100, -120, 
     385                -120, -100, 0, 
     386                0,    -100, 0, 
    386387                -120, -100, 120, 
    387                   0 , -100, 120, 
     388                0,    -100, 120, 
    388389 
    389390                 120, -100, -120, 
     
    392393        ], 
    393394        texcoords: [ 
    394                 0,   0  , 
    395                 0.5, 0  , 
     395                0,   0, 
     396                0.5, 0, 
    396397                0,   0.5, 
    397398                0.5, 0.5, 
    398399                0,   1, 
    399400                0.5, 1, 
    400                 1, 0, 
    401                 1, 0.5, 
    402                 1, 1 
     401                1,   0, 
     402                1,   0.5, 
     403                1,   1 
    403404        ], 
    404405        indices: [ 
  • lang/javascript/jscloth/trunk/parpevision.js

    r29905 r29983  
    3434        g.fillRect(0, 0, w, h); 
    3535 
    36 } 
     36}; 
    3737 
    3838P3D.num_cmp = function(a,b){return a-b;} 
     
    4343 
    4444        var g = this.g; 
    45          
     45 
    4646        var vAd = [ poss[1].x - poss[0].x , poss[1].y - poss[0].y ]; 
    4747        var vBd = [ poss[2].x - poss[0].x , poss[2].y - poss[0].y ]; 
     
    111111 
    112112        return true; 
    113 } 
     113}; 
    114114 
    115115P3D.drawTestByIndexBuffer = function(pos_buf, ix_buf, culling) { 
     
    201201 
    202202                var vCd = [ poss[2].x - poss[1].x , poss[2].y - poss[1].y ]; 
    203                  
     203 
    204204                // z component of cross product < 0 ? 
    205205                if( (((vAd[0] * vCd[1]) - (vAd[1] * vCd[0]))*culling) < 0) 
     
    232232 
    233233                var im = m.getInvert(); 
    234                 if (!im) { continue;} 
     234                if (!im) {continue;} 
    235235 
    236236                var a = im._11 * vAd[0] + im._12 * vBd[0]; 
     
    341341        }, 
    342342 
    343         dpWith: function(v)     { 
     343        dpWith: function(v) { 
    344344                return this.x*v.x + this.y*v.y + this.z*v.z; 
    345345        }, 
     
    356356                return this.x + ", " + this.y + "," + this.z; 
    357357        } 
    358 } 
     358}; 
    359359 
    360360function M44(cpy) 
     
    443443                var aX = new Vec3(); 
    444444                var aY = new Vec3(); 
    445          
     445 
    446446                var aZ = new Vec3(aAt.x, aAt.y, aAt.z); 
    447447                aZ.sub(aFrom).normalize(); 
    448          
     448 
    449449                aX.cp(aUp, aZ).normalize(); 
    450450                aY.cp(aZ, aX); 
    451          
     451 
    452452                this._11 = aX.x;  this._12 = aY.x;  this._13 = aZ.x;  this._14 = 0; 
    453453                this._21 = aX.y;  this._22 = aY.y;  this._23 = aZ.y;  this._24 = 0; 
    454454                this._31 = aX.z;  this._32 = aY.z;  this._33 = aZ.z;  this._34 = 0; 
    455          
     455 
    456456                this._41 = -aFrom.dpWith(aX); 
    457457                this._42 = -aFrom.dpWith(aY); 
    458458                this._43 = -aFrom.dpWith(aZ); 
    459459                this._44 = 1; 
    460          
     460 
    461461            return this; 
    462462        }, 
     
    573573        } 
    574574 
    575 } 
     575}; 
    576576 
    577577// matrix 2x2 
     
    598598 
    599599        return out; 
    600 }        
     600}; 
  • lang/javascript/jscloth/trunk/touch.html

    r29905 r29983  
    33<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> 
    44        <head> 
    5                 <meta name="viewport" content="width=480, user-scalable=no" />  
     5                <meta name="viewport" content="width=480, user-scalable=no" /> 
    66                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    77                <meta http-equiv="Content-Style-Type" content="text/css" /> 
     
    4343                <title>js iPod touch</title> 
    4444        </head> 
    45         <body onload="void( new TouchApp() );"> 
     45        <body onload="void new TouchApp();"> 
    4646                <div> 
    4747                        <canvas id="cv" width="480" height="300"></canvas> 
  • lang/javascript/jscloth/trunk/touch.js

    r29905 r29983  
    146146        drawFloor: function() { 
    147147                P3D.texture = this.texture2; 
    148 // console.log(MESH_floor.tl_poss[2] + "  " + MESH_floor.tl_poss[6]) 
     148// console.log(MESH_floor.tl_poss[2] + "  " + MESH_floor.tl_poss[6]); 
    149149                P3D.drawByIndexBuffer(MESH_floor.tl_poss, MESH_floor.face_groups[0], MESH_floor.texcoords, -1, true); 
    150150        } 
    151 } 
     151}; 
    152152 
    153153function iPodModel(mesh) { 
     
    274274                } 
    275275        } 
    276 } 
     276}; 
  • lang/javascript/jscloth/trunk/touchdat/tex2.png

    • Property svn:mime-type changed from application/octet-stream to image/png