BundleGroup.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { Group } from '../../objects/Group.js';
  2. /**
  3. * A specialized group which enables applications access to the
  4. * Render Bundle API of WebGPU. The group with all its descendant nodes
  5. * are considered as one render bundle and processed as such by
  6. * the renderer.
  7. *
  8. * This module is only fully supported by `WebGPURenderer` with a WebGPU backend.
  9. * With a WebGL backend, the group can technically be rendered but without
  10. * any performance improvements.
  11. *
  12. * @augments Group
  13. */
  14. class BundleGroup extends Group {
  15. /**
  16. * Constructs a new bundle 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.isBundleGroup = true;
  28. /**
  29. * This property is only relevant for detecting types
  30. * during serialization/deserialization. It should always
  31. * match the class name.
  32. *
  33. * @type {string}
  34. * @readonly
  35. * @default 'BundleGroup'
  36. */
  37. this.type = 'BundleGroup';
  38. /**
  39. * Whether the bundle is static or not. When set to `true`, the structure
  40. * is assumed to be static and does not change. E.g. no new objects are
  41. * added to the group.
  42. *
  43. * If a change is required, an update can still be forced by setting the
  44. * `needsUpdate` flag to `true`.
  45. *
  46. * @type {boolean}
  47. * @default true
  48. */
  49. this.static = true;
  50. /**
  51. * The bundle group's version.
  52. *
  53. * @type {number}
  54. * @readonly
  55. * @default 0
  56. */
  57. this.version = 0;
  58. }
  59. /**
  60. * Set this property to `true` when the bundle group has changed.
  61. *
  62. * @type {boolean}
  63. * @default false
  64. * @param {boolean} value
  65. */
  66. set needsUpdate( value ) {
  67. if ( value === true ) this.version ++;
  68. }
  69. }
  70. export default BundleGroup;
粤ICP备19079148号