Guest User

Untitled

a guest
Dec 21st, 2024
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. //shapeConfig
  2.  
  3. import * as THREE from 'three';
  4.  
  5. const lShape = new THREE.Shape()
  6. .moveTo(0, 0)
  7. .lineTo(5, 0)
  8. .lineTo(5, 10)
  9. .lineTo(0, 10)
  10. .lineTo(0, 5)
  11. .lineTo(-5, 5)
  12. .lineTo(-5, 0)
  13. .lineTo(0, 0);
  14.  
  15. const lShapeGeometry = new THREE.ShapeGeometry(lShape);
  16. lShapeGeometry.rotateX(Math.PI / 2);
  17.  
  18. const squareShape = new THREE.Shape()
  19. .moveTo(0, 0)
  20. .lineTo(10, 0)
  21. .lineTo(10, 10)
  22. .lineTo(0, 10)
  23. .lineTo(0, 0);
  24.  
  25. const squareGeometry = new THREE.ShapeGeometry(squareShape);
  26. squareGeometry.rotateX(Math.PI / 2);
  27.  
  28. const rectangleShape = new THREE.Shape()
  29. .moveTo(0, 0)
  30. .lineTo(10, 0)
  31. .lineTo(10, 5)
  32. .lineTo(0, 5)
  33. .lineTo(0, 0);
  34.  
  35. const rectangleGeometry = new THREE.ShapeGeometry(rectangleShape);
  36. rectangleGeometry.rotateX(Math.PI / 2);
  37.  
  38. export const shapes = {
  39. square: squareGeometry,
  40. rectangle: rectangleGeometry,
  41. lshape: lShapeGeometry,
  42. custom: null, // Placeholder for freehand shape
  43. };
  44.  
Advertisement
Add Comment
Please, Sign In to add comment