comparison Pants_FPS/PantsFPS.html @ 17:bf87fe5a9797

ver3
author <e085737>
date Fri, 10 Dec 2010 20:19:03 +0900
parents 9367d87879ee
children 931ad40d56f5
comparison
equal deleted inserted replaced
16:9367d87879ee 17:bf87fe5a9797
75 } 75 }
76 76
77 width = 1; 77 width = 1;
78 height = -1; 78 height = -1;
79 79
80 function reshape(ctx) 80 function reshape(ctx, sgroot)
81 { 81 {
82 var canvas = document.getElementById('example'); 82 var canvas = document.getElementById('example');
83 if (canvas.width == width && canvas.width == height) 83 if (canvas.width == width && canvas.width == height)
84 return; 84 return;
85 85
86 width = canvas.width 86 width = canvas.width
87 height = canvas.height 87 height = canvas.height
88 // 画面の調節はいまだ手作業 88 // 画面の調節はいまだ手作業
89 89
90 ctx.viewport(0, 0, width, height); 90 ctx.viewport(0, 0, width, height);
91 ctx.perspectiveMatrix = new J3DIMatrix4(); 91 //ctx.perspectiveMatrix = new J3DIMatrix4()
92 92 //sgroot.getCamera(ctx)
93 ctx.perspectiveMatrix.perspective(45, width/height, 1, 10000);
94 ctx.perspectiveMatrix.rotate(cameraAngle_xyz[0],0,1,0)
95 ctx.perspectiveMatrix.rotate(cameraAngle_xyz[1], angleRate_xyz[0], 0, angleRate_xyz[2])
96 //ctx.perspectiveMatrix.rotate(cameraAngle_xyz[1], -1, 0, 1)
97
98
99 ctx.perspectiveMatrix.lookat(position_xyz[0],position_xyz[1],position_xyz[2], aim_xyz[0], aim_xyz[1], aim_xyz[2], 0, -1, 0);
100 // ctx.perspectiveMatrix.lookat(0, 0, -500, 0, 0, 0, 0, -1, 0);
101 93
102 } 94 }
103 95
104 function drawObject(ctx, node, angle, xyz, scale, glObj) 96 function drawObject(ctx, node, angle, xyz, scale, glObj)
105 { 97 {
150 ctx.drawElements(ctx.TRIANGLES, glObj.numIndices, ctx.UNSIGNED_SHORT, 0); 142 ctx.drawElements(ctx.TRIANGLES, glObj.numIndices, ctx.UNSIGNED_SHORT, 0);
151 } 143 }
152 144
153 function drawPicture(ctx,sgroot,w,h) 145 function drawPicture(ctx,sgroot,w,h)
154 { 146 {
155 reshape(ctx); 147 reshape(ctx, sgroot)
156 ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT); 148 ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT)
149 //sgroot.getCamera(ctx)
157 150
158 MainLoop(ctx,sgroot,w,h) 151 MainLoop(ctx,sgroot,w,h)
159 152
160 ctx.flush(); 153 ctx.flush();
161 154