ModelRenderResources.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import Check from "../../Core/Check.js";
  2. import ModelAlphaOptions from "./ModelAlphaOptions.js";
  3. import ShaderBuilder from "../../Renderer/ShaderBuilder.js";
  4. /**
  5. * Model render resources are for setting details that are consistent across
  6. * the entire model.
  7. *
  8. * @constructor
  9. * @param {ModelExperimental} model The model that will be rendered
  10. *
  11. * @private
  12. */
  13. export default function ModelRenderResources(model) {
  14. //>>includeStart('debug', pragmas.debug);
  15. Check.typeOf.object("model", model);
  16. //>>includeEnd('debug');
  17. /**
  18. * An object used to build a shader incrementally. Each pipeline stage
  19. * may add lines of shader code to this object.
  20. *
  21. * @type {ShaderBuilder}
  22. * @readonly
  23. *
  24. * @private
  25. */
  26. this.shaderBuilder = new ShaderBuilder();
  27. /**
  28. * A reference to the model.
  29. *
  30. * @type {ModelExperimental}
  31. * @readonly
  32. *
  33. * @private
  34. */
  35. this.model = model;
  36. /**
  37. * A dictionary mapping uniform name to functions that return the uniform
  38. * values.
  39. *
  40. * @type {Object.<String, Function>}
  41. * @readonly
  42. *
  43. * @private
  44. */
  45. this.uniformMap = {};
  46. /**
  47. * Options for configuring the alpha stage such as pass and alpha mode.
  48. *
  49. * @type {ModelAlphaOptions}
  50. * @readonly
  51. *
  52. * @private
  53. */
  54. this.alphaOptions = new ModelAlphaOptions();
  55. /**
  56. * An object storing options for creating a {@link RenderState}.
  57. * The pipeline stages simply set the options, the render state is created
  58. * when the {@link DrawCommand} is constructed.
  59. *
  60. * @type {Object}
  61. * @readonly
  62. *
  63. * @private
  64. */
  65. this.renderStateOptions = {};
  66. }