init method

dynamic init()

Implementation

init() async
{
  // TODO
  // still did not figure out, how many vertexes should be...
  // three.jsでは可変にできない、ひとまず多めに用意

  var index = new Uint16Array ((_width + _height + _depth) * 30);
  var position = new Float32Array((_width + _height + _depth) * 30 * 3);
  var tex = new Float32Array((_width + _height + _depth) * 30 * 3);


  var geometry = new THREE.BufferGeometry();
  //geometry.dynamic = true;


  geometry.setIndex(new THREE.Uint16BufferAttribute(index, 1));
  //  geometry.attributes={'position': new THREE.BufferAttribute(position, 3),'tex': new THREE.BufferAttribute(tex, 3)});

  geometry.setAttribute(
      'position', THREE.Float32BufferAttribute(position, 3));
  geometry.setAttribute('tex', THREE.Float32BufferAttribute(tex, 3));


  var material = await initMaterial();

  this.mesh = new THREE.Mesh(
      geometry,
      material
  );

  this.mesh.updateMatrixWorld();
}