Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyTerrain extends Plane
- {
- constructor(scene, nrDivs, altimetry)
- {
- super(scene, nrDivs);
- this.nrDivs = nrDivs;
- this.altimetry = altimetry;
- this.nrDivs = nrDivs;
- //this.initBuffers();
- //this.plano = new Plane(this.scene);
- //this.plano.initBuffers();
- this.f1();
- };
- display()
- {
- // Plano
- this.scene.pushMatrix();
- this.scene.translate(0, -0.5, 0);
- this.scene.scale(50, 2, 50);
- this.scene.rotate(-90*Math.PI/180, 1, 0, 0)
- super.display();
- this.scene.popMatrix();
- };
- f1() {
- this.numVertices = this.nrDivs * this.nrDivs;
- for(let i = 0; i < this.altimetry.length; i++)
- for(let j = 0; j < this.altimetry[i].length; j++)
- console.log(this.altimetry[i][j]);
- var c = 0;
- for(var i = 0; i <= this.nrDivs; i++) {
- for(var j = 0; j <= this.nrDivs; j++) {
- this.vertices[c+2] = this.altimetry[i][j];
- c = c+3;
- }
- }
- this.initGLBuffers();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement