Advertisement
Guest User

Untitled

a guest
Mar 1st, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1.  
  2. ///////////////////////////////////////////
  3. ///////CIRCULO ///////////////////////////
  4. /////////////////////////////////////////
  5.  
  6. /*
  7.  
  8. MyObject.prototype.initBuffers = function () {
  9.  
  10. // a e b sao o centro
  11. var a = 0;
  12. var b = 0;
  13.  
  14. //coordenadas
  15. var z =0;
  16.  
  17. //angulo
  18.  
  19. var teta = 30; //angulos
  20. var angulo = (teta*2*Math.PI)/360; //radianos
  21.  
  22.  
  23. //raio
  24.  
  25. var r = 1.0;
  26.  
  27. this.vertices = [];
  28. this.indices = [];
  29.  
  30.  
  31. this.vertices.push(r);
  32. this.vertices.push(0);
  33. this.vertices.push(z);
  34.  
  35. while(angulo < 2*Math.PI){
  36. this.vertices.push(a+r*Math.cos(angulo));
  37. this.vertices.push(b+r*Math.sin(angulo));
  38. this.vertices.push(z);
  39. angulo = angulo + (teta*2*Math.PI)/360;
  40. }
  41.  
  42. // adicionar o centro
  43.  
  44. this.vertices.push(a);
  45. this.vertices.push(b);
  46. this.vertices.push(z);
  47.  
  48. var tamanho = (this.vertices.lengh-1);
  49.  
  50. for(i=1, j=0;i < tamanho ; j=0, i++){
  51. this.indices.push(j);
  52. this.indices.push(i);
  53.  
  54. this.indices.push(tamanho);
  55.  
  56. }
  57.  
  58.  
  59.  
  60. this.primitiveType=this.scene.gl.TRIANGLES;
  61. this.initGLBuffers();
  62. };
  63.  
  64. */
  65.  
  66. /////////////////////////////////////////
  67. ///////DODECAEDRO REGULAR //////////////
  68. ////////////////////////////////////////
  69. //////// MAAAAAAAAAAAAAAALLL////////////
  70. ////////////////////////////////////////
  71.  
  72. /*
  73. MyObject.prototype.initBuffers = function () {
  74. var y = 0.5;
  75. var e = 2.0;
  76. var h = 0.125;
  77. var a = 0.35;
  78. this.vertices = [
  79. e-y, e/2,e+h, //0
  80. e,0,e, //1
  81. e+h,y,e/2, //2
  82. e+h,y+a, e/2, //3
  83. e,e,e, //4
  84. y,e/2,e+h, //5
  85. 0,0,e, //6
  86. e/2,e+h, //7
  87. e/2,-h,y, //8
  88. e, 0, 0, //9
  89. e-y,e/2,-h, //10
  90. e, e, 0, //11
  91. e/2, e+h, y, //12
  92. e/2,e+h,y+1, //13
  93. 0, e,e, //14
  94. -h,y,e/2, //15
  95. 0, 0, 0, //16
  96. y,e/2,-h, //17
  97. 0, e, 0, //18
  98. -h,y+a,e/2, //19
  99. ];
  100.  
  101. this.indices = [
  102. 0,1,2,
  103. 2,3,4,
  104. 4,0,1,
  105. 9,2,3
  106.  
  107.  
  108. ];
  109.  
  110. this.primitiveType=this.scene.gl.TRIANGLES;
  111. this.initGLBuffers();
  112. };
  113.  
  114. */
  115.  
  116. /////////////////////////////////////////
  117. ///////PIRAMIDE TRIANGULAR //////////////
  118. /////////////////////////////////////////
  119.  
  120. /*
  121.  
  122. MyObject.prototype.initBuffers = function () {
  123. this.vertices = [
  124. 0, 0, 0, //0
  125. 0.5, 0, 0, //1
  126. 0.5, 0.5, 0, //2
  127. 0, 0.5, 0, //3
  128. 0.25,0.25,1.0, //4
  129.  
  130. ];
  131.  
  132. this.indices = [
  133. 0,1,2,
  134. 0,1,4,
  135. 2,4,1,
  136. 1,0,3,
  137. 3,2,1,
  138. 0,4,2
  139.  
  140. ];
  141.  
  142. this.primitiveType=this.scene.gl.TRIANGLES;
  143. this.initGLBuffers();
  144. };
  145.  
  146. */
  147.  
  148.  
  149. ///////////////////////////////////////////
  150. ///////PIRAMIDE QUADRANGULAR //////////////
  151. /////////////////////////////////////////
  152.  
  153. /*
  154.  
  155. MyObject.prototype.initBuffers = function () {
  156. this.vertices = [
  157. 0, 0, 0, //0
  158. 0.5, 0, 0, //1
  159. 0.5, 0.5, 0, //2
  160. 0, 0.5, 0, //3
  161. 0.25,0.25,1.0, //4
  162.  
  163. ];
  164.  
  165. this.indices = [
  166. 0,1,2,
  167. 2,3,0,
  168. 0,1,4,
  169. 2,4,1,
  170. 3,4,2,
  171. 0,4,3,
  172. 1,0,3,
  173. 3,2,1
  174.  
  175. ];
  176.  
  177. this.primitiveType=this.scene.gl.TRIANGLES;
  178. this.initGLBuffers();
  179. };
  180. */
  181.  
  182.  
  183. ///////////////////////////////////////////
  184. /////// CUBO ////////////////////////////
  185. /////////////////////////////////////////
  186.  
  187. /*
  188.  
  189. MyObject.prototype.initBuffers = function () {
  190.  
  191. this.vertices = [
  192. -0.5, -0.5, 0, //0
  193. 0.5, -0.5, 0, //1
  194. -0.5, 0.5, 0, //2
  195. 0.5, 0.5, 0, //3
  196. 0.5,-0.5,0.5, //4
  197. 0.5,0.5,0.5, //5
  198. -0.5,0.5,0.5, //6
  199. -0.5,-0.5,0.5, //7
  200.  
  201. ];
  202.  
  203. this.indices = [
  204. 2,3,1,
  205. 1,0,2,
  206. 4,5,6,
  207. 6,7,4,
  208. 5,4,1,
  209. 1,3,5,
  210. 0,7,6,
  211. 6,2,0,
  212. 5,3,2,
  213. 2,6,5,
  214. 4,7,0,
  215. 0,1,4,
  216.  
  217. ];
  218.  
  219. this.primitiveType=this.scene.gl.TRIANGLES;
  220. this.initGLBuffers();
  221.  
  222. };
  223.  
  224. */
  225.  
  226.  
  227. ///////////////////////////////////////////
  228. /////// ORGINAL //////////////////////////
  229. /////////////////////////////////////////
  230.  
  231.  
  232. MyObject.prototype.initBuffers = function () {
  233. this.vertices = [
  234. -0.5, -0.5, 0, //0
  235. 0.5, -0.5, 0, //1
  236. -0.5, 0.5, 0, //2
  237. 0.5, 0.5, 0, //3
  238. 0,1.0,0, //4
  239. 1.0,0.5,0 //5
  240. -1.0,0.5,0 //6
  241. ];
  242.  
  243. this.indices = [
  244. 0,1,3,
  245. 3,2,0,
  246. 5,4,6
  247. ];
  248.  
  249. this.primitiveType=this.scene.gl.TRIANGLES;
  250. this.initGLBuffers();
  251. };
  252.  
  253.  
  254. ///////////////////////////////////////////
  255. /////// PRIMEIRO //////////////////////////
  256. /////////////////////////////////////////
  257. /*
  258. MyObject.prototype.initBuffers = function () {
  259. this.vertices = [
  260. -0.5, -0.5, 0, //0
  261. 0.5, -0.5, 0, //1
  262. -0.5, 0.5, 0, //2
  263. 0.5, 0.5, 0, //3
  264. 0,1.5, 0, //4
  265. 1.0,0.5,0, //5
  266. -1.0,0.5,0 //6
  267. ];
  268.  
  269. this.indices = [
  270. 0,1,3,
  271. 3,2,0,
  272. 5,4,6
  273. ];
  274.  
  275. this.primitiveType=this.scene.gl.TRIANGLES;
  276. this.initGLBuffers();
  277. };
  278.  
  279. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement