ImgLabel.js 746 B

123456789101112131415161718192021222324252627282930
  1. import * as THREE from "three";
  2. import TouchEdge from "./TouchEdge";
  3. export default class ImgLabel extends THREE.Mesh {
  4. constructor(texture, matLine) {
  5. const width = 1.5;
  6. const height = 0.85;
  7. const g = new THREE.PlaneGeometry(width, height);
  8. g.rotateX(-Math.PI / 2);
  9. const m = new THREE.MeshBasicMaterial({
  10. map: texture,
  11. });
  12. super(g, m);
  13. // console.log(g);
  14. const p = [
  15. [-0.75, 0, -0.425, 0.75, 0, -0.425],
  16. [-0.75, 0, -0.425, -0.75, 0, 0.425],
  17. [-0.75, 0, 0.425, 0.75, 0, 0.425],
  18. [0.75, 0, 0.425, 0.75, 0, -0.425],
  19. ];
  20. this.touchLines = new TouchEdge(p, matLine);
  21. this.touchLines.position.y += 0.5;
  22. this.add(this.touchLines);
  23. this.name = "imglabel";
  24. }
  25. }