drawWrapper.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /** @internal */
  2. export class DrawWrapper {
  3. static GetEffect(effect) {
  4. return effect.getPipelineContext === undefined ? effect.effect : effect;
  5. }
  6. constructor(engine, createMaterialContext = true) {
  7. /**
  8. * @internal
  9. * Specifies if the effect was previously ready
  10. */
  11. this._wasPreviouslyReady = false;
  12. /**
  13. * @internal
  14. * Forces the code from bindForSubMesh to be fully run the next time it is called
  15. */
  16. this._forceRebindOnNextCall = true;
  17. /**
  18. * @internal
  19. * Specifies if the effect was previously using instances
  20. */
  21. this._wasPreviouslyUsingInstances = null;
  22. this.effect = null;
  23. this.defines = null;
  24. this.drawContext = engine.createDrawContext();
  25. if (createMaterialContext) {
  26. this.materialContext = engine.createMaterialContext();
  27. }
  28. }
  29. setEffect(effect, defines, resetContext = true) {
  30. this.effect = effect;
  31. if (defines !== undefined) {
  32. this.defines = defines;
  33. }
  34. if (resetContext) {
  35. this.drawContext?.reset();
  36. }
  37. }
  38. dispose() {
  39. this.drawContext?.dispose();
  40. }
  41. }
  42. //# sourceMappingURL=drawWrapper.js.map