Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // a e b sao o centro
- var a = 0;
- var b = 0;
- //coordenadas
- var z =0;
- //angulo
- var teta = 30; //angulos
- var angulo = (teta*2*Math.PI)/360; //radianos
- //raio
- var r = 1.0;
- this.vertices = [];
- this.indices = [];
- this.vertices.push(r);
- this.vertices.push(0);
- this.vertices.push(z);
- while(angulo < 2*Math.PI){
- this.vertices.push(a+r*Math.cos(angulo));
- this.vertices.push(b+r*Math.sin(angulo));
- this.vertices.push(z);
- angulo = angulo + (teta*2*Math.PI)/360;
- }
- // adicionar o centro
- this.vertices.push(a);
- this.vertices.push(b);
- this.vertices.push(z);
- for(i=1;i <= (this.vertices.lengh-1); ++i){
- this.indices.push(--i);
- this.indices.push(i);
- this.indices.push(this.vertices.lengh-1);
- }
- /*
- this.vertices = [
- 0, 0, 0, //0
- , 0, 0, //1
- 0.5, 0.5, 0, //2
- 0, 0.5, 0, //3
- 0.25,0.25,1.0, //4
- ];
- this.indices = [
- 0,1,2,
- 2,3,0,
- 0,1,4,
- 2,4,1,
- 3,4,2,
- 0,4,3,
- 1,0,3,
- 3,2,1
- ];
- */
- this.primitiveType=this.scene.gl.TRIANGLES;
- this.initGLBuffers()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement