智慧水务管理系统 - 精河县供水工程综合管理平台

GaussianSplatRenderResources.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import ShaderBuilder from "../Renderer/ShaderBuilder.js";
  2. import RenderState from "../Renderer/RenderState.js";
  3. import DepthFunction from "../Scene/DepthFunction.js";
  4. import ModelAlphaOptions from "./Model/ModelAlphaOptions.js";
  5. import ShaderDestination from "../Renderer/ShaderDestination.js";
  6. function GaussianSplatRenderResources(primitive) {
  7. const shaderBuilder = new ShaderBuilder();
  8. /**
  9. * An object used to build a shader incrementally. Each pipeline stage
  10. * may add lines of shader code to this object.
  11. *
  12. * @type {ShaderBuilder}
  13. * @readonly
  14. *
  15. * @private
  16. */
  17. this.shaderBuilder = shaderBuilder;
  18. /**
  19. * A dictionary mapping uniform name to functions that return the uniform
  20. * values.
  21. *
  22. * @type {Object<string, Function>}
  23. * @readonly
  24. *
  25. * @private
  26. */
  27. this.uniformMap = {};
  28. /**
  29. * An object storing options for creating a {@link RenderState}.
  30. * The pipeline stages simply set the options, the render state is created
  31. * when the {@link DrawCommand} is constructed.
  32. *
  33. * @type {object}
  34. * @readonly
  35. *
  36. * @private
  37. */
  38. this.renderStateOptions = RenderState.getState(
  39. RenderState.fromCache({
  40. depthTest: {
  41. enabled: true,
  42. func: DepthFunction.LESS_OR_EQUAL,
  43. },
  44. }),
  45. );
  46. /**
  47. * Options for configuring the alpha stage such as pass and alpha cutoff.
  48. *
  49. * @type {ModelAlphaOptions}
  50. * @readonly
  51. *
  52. * @private
  53. */
  54. this.alphaOptions = new ModelAlphaOptions();
  55. /**
  56. * Whether the model is part of a tileset that uses the skipLevelOfDetail
  57. * optimization. This value indicates what draw commands are needed and
  58. * is set by TilesetPipelineStage.
  59. *
  60. * @type {boolean}
  61. * @default false
  62. *
  63. * @private
  64. */
  65. this.hasSkipLevelOfDetail = false;
  66. if (primitive._useLogDepth) {
  67. shaderBuilder.addDefine(
  68. "LOG_DEPTH_READ_ONLY",
  69. undefined,
  70. ShaderDestination.FRAGMENT,
  71. );
  72. }
  73. }
  74. export default GaussianSplatRenderResources;