ImgLabel.js 700 B

12345678910111213141516171819202122232425
  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 = [[-0.75, 0, -0.425, 0.75, 0, -0.425], [-0.75, 0, -0.425, -0.75, 0, 0.425], [-0.75, 0, 0.425, 0.75, 0, 0.425], [0.75, 0, 0.425, 0.75, 0, -0.425]]
  15. this.touchLines = new TouchEdge(p, matLine)
  16. this.touchLines.position.y += 0.5
  17. this.add( this.touchLines );
  18. this.name = 'imglabel'
  19. }
  20. }