fluidRenderingDepthTextureCopy.js 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. import { CopyTextureToTexture } from "../../Misc/copyTextureToTexture.js";
  2. /** @internal */
  3. export class FluidRenderingDepthTextureCopy {
  4. get depthRTWrapper() {
  5. return this._depthRTWrapper;
  6. }
  7. constructor(engine, width, height, samples = 1) {
  8. this._engine = engine;
  9. this._copyTextureToTexture = new CopyTextureToTexture(engine, true);
  10. this._depthRTWrapper = this._engine.createRenderTargetTexture({ width, height }, {
  11. generateMipMaps: false,
  12. type: 0,
  13. format: 6,
  14. samplingMode: 1,
  15. generateDepthBuffer: true,
  16. generateStencilBuffer: false,
  17. samples,
  18. noColorAttachment: true,
  19. label: "FluidRenderingDepthTextureCopyRTT",
  20. });
  21. const depthTexture = this._depthRTWrapper.createDepthStencilTexture(0, false, false, 1, undefined, "FluidRenderingDepthTextureCopyRTTDepthStencil");
  22. depthTexture.label = `FluidDepthTextureCopy${width}x${height}x${samples}`;
  23. }
  24. copy(source) {
  25. return this._copyTextureToTexture.copy(source, this._depthRTWrapper);
  26. }
  27. dispose() {
  28. this._depthRTWrapper.dispose();
  29. this._copyTextureToTexture.dispose();
  30. }
  31. }
  32. //# sourceMappingURL=fluidRenderingDepthTextureCopy.js.map