sceneComponent.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /**
  2. * Groups all the scene component constants in one place to ease maintenance.
  3. * @internal
  4. */
  5. export class SceneComponentConstants {
  6. }
  7. SceneComponentConstants.NAME_EFFECTLAYER = "EffectLayer";
  8. SceneComponentConstants.NAME_LAYER = "Layer";
  9. SceneComponentConstants.NAME_LENSFLARESYSTEM = "LensFlareSystem";
  10. SceneComponentConstants.NAME_BOUNDINGBOXRENDERER = "BoundingBoxRenderer";
  11. SceneComponentConstants.NAME_PARTICLESYSTEM = "ParticleSystem";
  12. SceneComponentConstants.NAME_GAMEPAD = "Gamepad";
  13. SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE = "SimplificationQueue";
  14. SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER = "GeometryBufferRenderer";
  15. SceneComponentConstants.NAME_PREPASSRENDERER = "PrePassRenderer";
  16. SceneComponentConstants.NAME_DEPTHRENDERER = "DepthRenderer";
  17. SceneComponentConstants.NAME_DEPTHPEELINGRENDERER = "DepthPeelingRenderer";
  18. SceneComponentConstants.NAME_POSTPROCESSRENDERPIPELINEMANAGER = "PostProcessRenderPipelineManager";
  19. SceneComponentConstants.NAME_SPRITE = "Sprite";
  20. SceneComponentConstants.NAME_SUBSURFACE = "SubSurface";
  21. SceneComponentConstants.NAME_OUTLINERENDERER = "Outline";
  22. SceneComponentConstants.NAME_PROCEDURALTEXTURE = "ProceduralTexture";
  23. SceneComponentConstants.NAME_SHADOWGENERATOR = "ShadowGenerator";
  24. SceneComponentConstants.NAME_OCTREE = "Octree";
  25. SceneComponentConstants.NAME_PHYSICSENGINE = "PhysicsEngine";
  26. SceneComponentConstants.NAME_AUDIO = "Audio";
  27. SceneComponentConstants.NAME_FLUIDRENDERER = "FluidRenderer";
  28. SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;
  29. SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;
  30. SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;
  31. SceneComponentConstants.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER = 0;
  32. SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER = 1;
  33. SceneComponentConstants.STEP_BEFORECAMERADRAW_PREPASS = 0;
  34. SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER = 1;
  35. SceneComponentConstants.STEP_BEFORECAMERADRAW_LAYER = 2;
  36. SceneComponentConstants.STEP_BEFORERENDERTARGETDRAW_PREPASS = 0;
  37. SceneComponentConstants.STEP_BEFORERENDERTARGETDRAW_LAYER = 1;
  38. SceneComponentConstants.STEP_BEFORERENDERINGMESH_PREPASS = 0;
  39. SceneComponentConstants.STEP_BEFORERENDERINGMESH_OUTLINE = 1;
  40. SceneComponentConstants.STEP_AFTERRENDERINGMESH_PREPASS = 0;
  41. SceneComponentConstants.STEP_AFTERRENDERINGMESH_OUTLINE = 1;
  42. SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW = 0;
  43. SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER = 1;
  44. SceneComponentConstants.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0;
  45. SceneComponentConstants.STEP_BEFORECAMERAUPDATE_GAMEPAD = 1;
  46. SceneComponentConstants.STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0;
  47. SceneComponentConstants.STEP_BEFORECLEAR_PREPASS = 1;
  48. SceneComponentConstants.STEP_BEFORERENDERTARGETCLEAR_PREPASS = 0;
  49. SceneComponentConstants.STEP_AFTERRENDERTARGETDRAW_PREPASS = 0;
  50. SceneComponentConstants.STEP_AFTERRENDERTARGETDRAW_LAYER = 1;
  51. SceneComponentConstants.STEP_AFTERCAMERADRAW_PREPASS = 0;
  52. SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER = 1;
  53. SceneComponentConstants.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 2;
  54. SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 3;
  55. SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER = 4;
  56. SceneComponentConstants.STEP_AFTERCAMERADRAW_FLUIDRENDERER = 5;
  57. SceneComponentConstants.STEP_AFTERCAMERAPOSTPROCESS_LAYER = 0;
  58. SceneComponentConstants.STEP_AFTERRENDERTARGETPOSTPROCESS_LAYER = 0;
  59. SceneComponentConstants.STEP_AFTERRENDER_AUDIO = 0;
  60. SceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 0;
  61. SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1;
  62. SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 2;
  63. SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3;
  64. SceneComponentConstants.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER = 0;
  65. SceneComponentConstants.STEP_GATHERACTIVECAMERARENDERTARGETS_FLUIDRENDERER = 1;
  66. SceneComponentConstants.STEP_POINTERMOVE_SPRITE = 0;
  67. SceneComponentConstants.STEP_POINTERDOWN_SPRITE = 0;
  68. SceneComponentConstants.STEP_POINTERUP_SPRITE = 0;
  69. /**
  70. * Representation of a stage in the scene (Basically a list of ordered steps)
  71. * @internal
  72. */
  73. export class Stage extends Array {
  74. /**
  75. * Hide ctor from the rest of the world.
  76. * @param items The items to add.
  77. */
  78. constructor(items) {
  79. super(...items);
  80. }
  81. /**
  82. * Creates a new Stage.
  83. * @returns A new instance of a Stage
  84. */
  85. static Create() {
  86. return Object.create(Stage.prototype);
  87. }
  88. /**
  89. * Registers a step in an ordered way in the targeted stage.
  90. * @param index Defines the position to register the step in
  91. * @param component Defines the component attached to the step
  92. * @param action Defines the action to launch during the step
  93. */
  94. registerStep(index, component, action) {
  95. let i = 0;
  96. let maxIndex = Number.MAX_VALUE;
  97. for (; i < this.length; i++) {
  98. const step = this[i];
  99. maxIndex = step.index;
  100. if (index < maxIndex) {
  101. break;
  102. }
  103. }
  104. this.splice(i, 0, { index, component, action: action.bind(component) });
  105. }
  106. /**
  107. * Clears all the steps from the stage.
  108. */
  109. clear() {
  110. this.length = 0;
  111. }
  112. }
  113. //# sourceMappingURL=sceneComponent.js.map