Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. class MyTerrain extends Plane
  2. {
  3. constructor(scene, nrDivs, altimetry)
  4. {
  5. super(scene, nrDivs);
  6. this.nrDivs = nrDivs;
  7. this.altimetry = altimetry;
  8. this.nrDivs = nrDivs;
  9. //this.initBuffers();
  10. //this.plano = new Plane(this.scene);
  11. //this.plano.initBuffers();
  12. this.f1();
  13. };
  14.  
  15. display()
  16. {
  17. // Plano
  18.  
  19.  
  20. this.scene.pushMatrix();
  21. this.scene.translate(0, -0.5, 0);
  22. this.scene.scale(50, 2, 50);
  23. this.scene.rotate(-90*Math.PI/180, 1, 0, 0)
  24. super.display();
  25. this.scene.popMatrix();
  26. };
  27.  
  28. f1() {
  29.  
  30. this.numVertices = this.nrDivs * this.nrDivs;
  31.  
  32. for(let i = 0; i < this.altimetry.length; i++)
  33. for(let j = 0; j < this.altimetry[i].length; j++)
  34. console.log(this.altimetry[i][j]);
  35.  
  36. var c = 0;
  37. for(var i = 0; i <= this.nrDivs; i++) {
  38.  
  39. for(var j = 0; j <= this.nrDivs; j++) {
  40.  
  41. this.vertices[c+2] = this.altimetry[i][j];
  42. c = c+3;
  43.  
  44. }
  45.  
  46.  
  47. }
  48.  
  49. this.initGLBuffers();
  50. }
  51.  
  52. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement