ClippingGroup.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { Group } from './Group.js';
  2. /**
  3. * In earlier three.js versions, clipping was defined globally
  4. * on the renderer or on material level. This special version of
  5. * `THREE.Group` allows to encode the clipping state into the scene
  6. * graph. Meaning if you create an instance of this group, all
  7. * descendant 3D objects will be affected by the respective clipping
  8. * planes.
  9. *
  10. * Note: `ClippingGroup` can only be used with `WebGPURenderer`.
  11. *
  12. * @augments Group
  13. */
  14. class ClippingGroup extends Group {
  15. /**
  16. * Constructs a new clipping group.
  17. */
  18. constructor() {
  19. super();
  20. /**
  21. * This flag can be used for type testing.
  22. *
  23. * @type {boolean}
  24. * @readonly
  25. * @default true
  26. */
  27. this.isClippingGroup = true;
  28. /**
  29. * An array with clipping planes.
  30. *
  31. * @type {Array<Plane>}
  32. */
  33. this.clippingPlanes = [];
  34. /**
  35. * Whether clipping should be enabled or not.
  36. *
  37. * @type {boolean}
  38. * @default true
  39. */
  40. this.enabled = true;
  41. /**
  42. * Whether the intersection of the clipping planes is used to clip objects, rather than their union.
  43. *
  44. * @type {boolean}
  45. * @default false
  46. */
  47. this.clipIntersection = false;
  48. /**
  49. * Whether shadows should be clipped or not.
  50. *
  51. * @type {boolean}
  52. * @default false
  53. */
  54. this.clipShadows = false;
  55. }
  56. }
  57. export { ClippingGroup };
粤ICP备19079148号