engine.multiview.d.ts 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { Camera } from "../../Cameras/camera";
  2. import type { Nullable } from "../../types";
  3. import type { RenderTargetTexture } from "../../Materials/Textures/renderTargetTexture";
  4. import { Matrix } from "../../Maths/math.vector";
  5. import { UniformBuffer } from "../../Materials/uniformBuffer";
  6. import type { RenderTargetWrapper } from "../renderTargetWrapper";
  7. declare module "../../Engines/engine" {
  8. interface Engine {
  9. /**
  10. * Creates a new multiview render target
  11. * @param width defines the width of the texture
  12. * @param height defines the height of the texture
  13. * @returns the created multiview render target wrapper
  14. */
  15. createMultiviewRenderTargetTexture(width: number, height: number, colorTexture?: WebGLTexture, depthStencilTexture?: WebGLTexture): RenderTargetWrapper;
  16. /**
  17. * Binds a multiview render target wrapper to be drawn to
  18. * @param multiviewTexture render target wrapper to bind
  19. */
  20. bindMultiviewFramebuffer(multiviewTexture: RenderTargetWrapper): void;
  21. /**
  22. * Binds a Space Warp render target wrapper to be drawn to
  23. * @param spaceWarpTexture render target wrapper to bind
  24. */
  25. bindSpaceWarpFramebuffer(spaceWarpTexture: RenderTargetWrapper): void;
  26. }
  27. }
  28. declare module "../../Cameras/camera" {
  29. interface Camera {
  30. /**
  31. * @internal
  32. * For cameras that cannot use multiview images to display directly. (e.g. webVR camera will render to multiview texture, then copy to each eye texture and go from there)
  33. */
  34. _useMultiviewToSingleView: boolean;
  35. /**
  36. * @internal
  37. * For cameras that cannot use multiview images to display directly. (e.g. webVR camera will render to multiview texture, then copy to each eye texture and go from there)
  38. */
  39. _multiviewTexture: Nullable<RenderTargetTexture>;
  40. /**
  41. * @internal
  42. * For WebXR cameras that are rendering to multiview texture arrays.
  43. */
  44. _renderingMultiview: boolean;
  45. /**
  46. * @internal
  47. * ensures the multiview texture of the camera exists and has the specified width/height
  48. * @param width height to set on the multiview texture
  49. * @param height width to set on the multiview texture
  50. */
  51. _resizeOrCreateMultiviewTexture(width: number, height: number): void;
  52. }
  53. }
  54. declare module "../../scene" {
  55. interface Scene {
  56. /** @internal */
  57. _transformMatrixR: Matrix;
  58. /** @internal */
  59. _multiviewSceneUbo: Nullable<UniformBuffer>;
  60. /** @internal */
  61. _createMultiviewUbo(): void;
  62. /** @internal */
  63. _updateMultiviewUbo(viewR?: Matrix, projectionR?: Matrix): void;
  64. /** @internal */
  65. _renderMultiviewToSingleView(camera: Camera): void;
  66. }
  67. }