Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1.  
  2. // a e b sao o centro
  3. var a = 0;
  4. var b = 0;
  5.  
  6. //coordenadas
  7. var z =0;
  8.  
  9. //angulo
  10.  
  11. var teta = 30; //angulos
  12. var angulo = (teta*2*Math.PI)/360; //radianos
  13.  
  14.  
  15. //raio
  16.  
  17. var r = 1.0;
  18.  
  19. this.vertices = [];
  20. this.indices = [];
  21.  
  22.  
  23. this.vertices.push(r);
  24. this.vertices.push(0);
  25. this.vertices.push(z);
  26.  
  27. while(angulo < 2*Math.PI){
  28. this.vertices.push(a+r*Math.cos(angulo));
  29. this.vertices.push(b+r*Math.sin(angulo));
  30. this.vertices.push(z);
  31. angulo = angulo + (teta*2*Math.PI)/360;
  32. }
  33.  
  34. // adicionar o centro
  35.  
  36. this.vertices.push(a);
  37. this.vertices.push(b);
  38. this.vertices.push(z);
  39.  
  40.  
  41. for(i=1;i <= (this.vertices.lengh-1); ++i){
  42. this.indices.push(--i);
  43. this.indices.push(i);
  44. this.indices.push(this.vertices.lengh-1);
  45. }
  46.  
  47.  
  48. /*
  49.  
  50. this.vertices = [
  51. 0, 0, 0, //0
  52. , 0, 0, //1
  53. 0.5, 0.5, 0, //2
  54. 0, 0.5, 0, //3
  55. 0.25,0.25,1.0, //4
  56.  
  57. ];
  58.  
  59. this.indices = [
  60. 0,1,2,
  61. 2,3,0,
  62. 0,1,4,
  63. 2,4,1,
  64. 3,4,2,
  65. 0,4,3,
  66. 1,0,3,
  67. 3,2,1
  68.  
  69. ];
  70.  
  71. */
  72.  
  73. this.primitiveType=this.scene.gl.TRIANGLES;
  74. this.initGLBuffers()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement