Facebook
From Unique Bee, 2 Years ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 57
  1. class Polygon {
  2.     constructor (x, y, z, geometry, material, visibility, init) {
  3.         this.x = x;
  4.         this.y = y;
  5.         this.z = z;
  6.         this.shape = new THREE.Mesh(geometry, material);
  7.         this.visibility = visibility;
  8.         init.call(this);
  9.     }
  10. }
  11.  
  12. const objects = {
  13.     hasLoaded: (object) => object.shape != undefined,
  14.  
  15.     polygonModels: {
  16.         ground: new Polygon(0, 0, 0, new THREE.PlaneGeometry(100, 100, 1), materials.ground, true, function (this) {
  17.                 this.shape.rotateX(Math.PI / 2);
  18.                 this.shape.translateX(-1);
  19.         }),
  20.         testCube: new Polygon(10, 10, 10, new THREE.BoxGeometry(1, 1, 1), materials.noahTaylor, true, null),
  21.     },
  22.  
  23. ...