@onerjs/core 8.53.7 → 8.53.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -146,6 +146,7 @@ export declare class ThinEngine extends AbstractEngine {
146
146
  private _nextFreeTextureSlots;
147
147
  private _maxSimultaneousTextures;
148
148
  private _maxMSAASamplesOverride;
149
+ private _mainPassSampleCount;
149
150
  protected get _supportsHardwareTextureRescaling(): boolean;
150
151
  /**
151
152
  * Creates a new snapshot at the next frame using the current snapshotRenderingMode
@@ -215,6 +216,16 @@ export declare class ThinEngine extends AbstractEngine {
215
216
  * @returns a number defining the current render height
216
217
  */
217
218
  getRenderHeight(useScreen?: boolean): number;
219
+ /**
220
+ * Gets the number of samples used by the current render target
221
+ * @returns the current sample count, or 1 when multisampling is disabled
222
+ */
223
+ get currentSampleCount(): number;
224
+ /**
225
+ * Enable or disable alpha-to-coverage
226
+ * @param enable defines the state to set
227
+ */
228
+ setAlphaToCoverage(enable: boolean): void;
218
229
  /**
219
230
  * Clear the current render buffer or the current render target (if any is set up)
220
231
  * @param color defines the color to use
@@ -112,6 +112,7 @@ export class ThinEngine extends AbstractEngine {
112
112
  this._nextFreeTextureSlots = new Array();
113
113
  this._maxSimultaneousTextures = 0;
114
114
  this._maxMSAASamplesOverride = null;
115
+ this._mainPassSampleCount = 1;
115
116
  // eslint-disable-next-line @typescript-eslint/naming-convention
116
117
  this._unpackFlipYCached = null;
117
118
  /**
@@ -306,6 +307,7 @@ export class ThinEngine extends AbstractEngine {
306
307
  return true;
307
308
  }
308
309
  _initGLContext() {
310
+ this._mainPassSampleCount = this._gl.getContextAttributes()?.antialias ? Math.max(1, this._gl.getParameter(this._gl.SAMPLES)) : 1;
309
311
  // Caps
310
312
  this._caps = {
311
313
  maxTexturesImageUnits: this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),
@@ -717,6 +719,23 @@ export class ThinEngine extends AbstractEngine {
717
719
  }
718
720
  return this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferHeight : this._gl.drawingBufferHeight;
719
721
  }
722
+ /**
723
+ * Gets the number of samples used by the current render target
724
+ * @returns the current sample count, or 1 when multisampling is disabled
725
+ */
726
+ get currentSampleCount() {
727
+ return this._currentRenderTarget?.samples ?? this._mainPassSampleCount;
728
+ }
729
+ /**
730
+ * Enable or disable alpha-to-coverage
731
+ * @param enable defines the state to set
732
+ */
733
+ setAlphaToCoverage(enable) {
734
+ super.setAlphaToCoverage(enable);
735
+ if (this._gl) {
736
+ this._alphaState.applyAlphaToCoverage(this._gl);
737
+ }
738
+ }
720
739
  /**
721
740
  * Clear the current render buffer or the current render target (if any is set up)
722
741
  * @param color defines the color to use