This commit is contained in:
Akko
2025-08-04 18:57:35 +02:00
parent 8cf6e78a79
commit 9495868c2e
5030 changed files with 518594 additions and 17609 deletions

View File

@@ -0,0 +1,181 @@
import { ExtensionType } from '../../../../extensions/Extensions';
import { type GpuPowerPreference } from '../../types';
import type { ICanvas } from '../../../../environment/canvas/ICanvas';
import type { System } from '../../shared/system/System';
import type { WebGLRenderer } from '../WebGLRenderer';
import type { WebGLExtensions } from './WebGLExtensions';
/**
* Options for the context system.
* @memberof rendering
* @property {WebGL2RenderingContext | null} [context=null] - User-provided WebGL rendering context object.
* @property {GpuPowerPreference} [powerPreference='default'] - An optional hint indicating what configuration
* of GPU is suitable for the WebGL context, can be `'high-performance'` or `'low-power'`. Setting to `'high-performance'`
* will prioritize rendering performance over power consumption, while setting to `'low-power'` will prioritize power saving
* over rendering performance.
* @property {boolean} [premultipliedAlpha=true] - Whether the compositor will assume the drawing buffer contains
* colors with premultiplied alpha.
* @property {boolean} [preserveDrawingBuffer=false] - Whether to enable drawing buffer preservation.
* If enabled, the drawing buffer will preserve
* its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.
* @property {boolean} [antialias] - Whether to enable antialiasing.
* @property {1 | 2} [preferWebGLVersion=2] - The preferred WebGL version to use.
*/
export interface ContextSystemOptions {
/**
* User-provided WebGL rendering context object.
* @default null
* @memberof rendering.SharedRendererOptions
*/
context: WebGL2RenderingContext | null;
/**
* An optional hint indicating what configuration of GPU is suitable for the WebGL context,
* can be `'high-performance'` or `'low-power'`.
* Setting to `'high-performance'` will prioritize rendering performance over power consumption,
* while setting to `'low-power'` will prioritize power saving over rendering performance.
* @memberof rendering.SharedRendererOptions
* @default undefined
*/
powerPreference?: GpuPowerPreference;
/**
* Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.
* @default true
* @memberof rendering.SharedRendererOptions
*/
premultipliedAlpha: boolean;
/**
* Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve
* its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.
* @default false
* @memberof rendering.SharedRendererOptions
*/
preserveDrawingBuffer: boolean;
antialias?: boolean;
/**
* The preferred WebGL version to use.
* @default 2
* @memberof rendering.SharedRendererOptions
*/
preferWebGLVersion?: 1 | 2;
/**
* Whether to enable multi-view rendering. Set to true when rendering to multiple
* canvases on the dom.
* @default false
* @memberof rendering.SharedRendererOptions
*/
multiView: boolean;
}
/**
* System plugin to the renderer to manage the context
* @memberof rendering
*/
export declare class GlContextSystem implements System<ContextSystemOptions> {
/** @ignore */
static extension: {
readonly type: readonly [ExtensionType.WebGLSystem];
readonly name: "context";
};
/** The default options for the system. */
static defaultOptions: ContextSystemOptions;
protected CONTEXT_UID: number;
protected gl: WebGL2RenderingContext;
/**
* Features supported by current renderer.
* @type {object}
* @readonly
*/
supports: {
/** Support for 32-bit indices buffer. */
uint32Indices: boolean;
/** Support for UniformBufferObjects */
uniformBufferObject: boolean;
/** Support for VertexArrayObjects */
vertexArrayObject: boolean;
/** Support for SRGB texture format */
srgbTextures: boolean;
/** Support for wrapping modes if a texture is non-power of two */
nonPowOf2wrapping: boolean;
/** Support for MSAA (antialiasing of dynamic textures) */
msaa: boolean;
/** Support for mipmaps if a texture is non-power of two */
nonPowOf2mipmaps: boolean;
};
/**
* Extensions available.
* @type {object}
* @readonly
* @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension
* @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension
* @property {OES_texture_float} floatTexture - WebGL v1 extension
* @property {WEBGL_lose_context} loseContext - WebGL v1 extension
* @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension
* @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension
*/
extensions: WebGLExtensions;
webGLVersion: 1 | 2;
/**
* Whether to enable multi-view rendering. Set to true when rendering to multiple
* canvases on the dom.
* @default false
*/
multiView: boolean;
/**
* The canvas that the WebGL Context is rendering to.
* This will be the view canvas. But if multiView is enabled, this canvas will not be attached to the DOM.
* It will be rendered to and then copied to the target canvas.
* @readonly
*/
canvas: ICanvas;
private _renderer;
private _contextLossForced;
/** @param renderer - The renderer this System works for. */
constructor(renderer: WebGLRenderer);
/**
* `true` if the context is lost
* @readonly
*/
get isLost(): boolean;
/**
* Handles the context change event.
* @param {WebGLRenderingContext} gl - New WebGL context.
*/
protected contextChange(gl: WebGL2RenderingContext): void;
init(options: ContextSystemOptions): void;
ensureCanvasSize(targetCanvas: ICanvas): void;
/**
* Initializes the context.
* @protected
* @param {WebGLRenderingContext} gl - WebGL context
*/
protected initFromContext(gl: WebGL2RenderingContext): void;
/**
* Initialize from context options
* @protected
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
* @param preferWebGLVersion
* @param {object} options - context attributes
*/
protected createContext(preferWebGLVersion: 1 | 2, options: WebGLContextAttributes): void;
/** Auto-populate the {@link GlContextSystem.extensions extensions}. */
protected getExtensions(): void;
/**
* Handles a lost webgl context
* @param {WebGLContextEvent} event - The context lost event.
*/
protected handleContextLost(event: WebGLContextEvent): void;
/** Handles a restored webgl context. */
protected handleContextRestored(): void;
destroy(): void;
/**
* this function can be called to force a webGL context loss
* this will release all resources on the GPU.
* Useful if you need to put Pixi to sleep, and save some GPU memory
*
* As soon as render is called - all resources will be created again.
*/
forceContextLoss(): void;
/**
* Validate context.
* @param {WebGLRenderingContext} gl - Render context.
*/
protected validateContext(gl: WebGL2RenderingContext): void;
}

View File

@@ -0,0 +1,279 @@
'use strict';
var adapter = require('../../../../environment/adapter.js');
var Extensions = require('../../../../extensions/Extensions.js');
var warn = require('../../../../utils/logging/warn.js');
"use strict";
const _GlContextSystem = class _GlContextSystem {
/** @param renderer - The renderer this System works for. */
constructor(renderer) {
/**
* Features supported by current renderer.
* @type {object}
* @readonly
*/
this.supports = {
/** Support for 32-bit indices buffer. */
uint32Indices: true,
/** Support for UniformBufferObjects */
uniformBufferObject: true,
/** Support for VertexArrayObjects */
vertexArrayObject: true,
/** Support for SRGB texture format */
srgbTextures: true,
/** Support for wrapping modes if a texture is non-power of two */
nonPowOf2wrapping: true,
/** Support for MSAA (antialiasing of dynamic textures) */
msaa: true,
/** Support for mipmaps if a texture is non-power of two */
nonPowOf2mipmaps: true
};
this._renderer = renderer;
this.extensions = /* @__PURE__ */ Object.create(null);
this.handleContextLost = this.handleContextLost.bind(this);
this.handleContextRestored = this.handleContextRestored.bind(this);
}
/**
* `true` if the context is lost
* @readonly
*/
get isLost() {
return !this.gl || this.gl.isContextLost();
}
/**
* Handles the context change event.
* @param {WebGLRenderingContext} gl - New WebGL context.
*/
contextChange(gl) {
this.gl = gl;
this._renderer.gl = gl;
}
init(options) {
options = { ..._GlContextSystem.defaultOptions, ...options };
let multiView = this.multiView = options.multiView;
if (options.context && multiView) {
warn.warn("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together.");
multiView = false;
}
if (multiView) {
this.canvas = adapter.DOMAdapter.get().createCanvas(this._renderer.canvas.width, this._renderer.canvas.height);
} else {
this.canvas = this._renderer.view.canvas;
}
if (options.context) {
this.initFromContext(options.context);
} else {
const alpha = this._renderer.background.alpha < 1;
const premultipliedAlpha = options.premultipliedAlpha ?? true;
const antialias = options.antialias && !this._renderer.backBuffer.useBackBuffer;
this.createContext(options.preferWebGLVersion, {
alpha,
premultipliedAlpha,
antialias,
stencil: true,
preserveDrawingBuffer: options.preserveDrawingBuffer,
powerPreference: options.powerPreference ?? "default"
});
}
}
ensureCanvasSize(targetCanvas) {
if (!this.multiView) {
if (targetCanvas !== this.canvas) {
warn.warn("multiView is disabled, but targetCanvas is not the main canvas");
}
return;
}
const { canvas } = this;
if (canvas.width < targetCanvas.width || canvas.height < targetCanvas.height) {
canvas.width = Math.max(targetCanvas.width, targetCanvas.width);
canvas.height = Math.max(targetCanvas.height, targetCanvas.height);
}
}
/**
* Initializes the context.
* @protected
* @param {WebGLRenderingContext} gl - WebGL context
*/
initFromContext(gl) {
this.gl = gl;
this.webGLVersion = gl instanceof adapter.DOMAdapter.get().getWebGLRenderingContext() ? 1 : 2;
this.getExtensions();
this.validateContext(gl);
this._renderer.runners.contextChange.emit(gl);
const element = this._renderer.view.canvas;
element.addEventListener("webglcontextlost", this.handleContextLost, false);
element.addEventListener("webglcontextrestored", this.handleContextRestored, false);
}
/**
* Initialize from context options
* @protected
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
* @param preferWebGLVersion
* @param {object} options - context attributes
*/
createContext(preferWebGLVersion, options) {
let gl;
const canvas = this.canvas;
if (preferWebGLVersion === 2) {
gl = canvas.getContext("webgl2", options);
}
if (!gl) {
gl = canvas.getContext("webgl", options);
if (!gl) {
throw new Error("This browser does not support WebGL. Try using the canvas renderer");
}
}
this.gl = gl;
this.initFromContext(this.gl);
}
/** Auto-populate the {@link GlContextSystem.extensions extensions}. */
getExtensions() {
const { gl } = this;
const common = {
anisotropicFiltering: gl.getExtension("EXT_texture_filter_anisotropic"),
floatTextureLinear: gl.getExtension("OES_texture_float_linear"),
s3tc: gl.getExtension("WEBGL_compressed_texture_s3tc"),
s3tc_sRGB: gl.getExtension("WEBGL_compressed_texture_s3tc_srgb"),
// eslint-disable-line camelcase
etc: gl.getExtension("WEBGL_compressed_texture_etc"),
etc1: gl.getExtension("WEBGL_compressed_texture_etc1"),
pvrtc: gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
atc: gl.getExtension("WEBGL_compressed_texture_atc"),
astc: gl.getExtension("WEBGL_compressed_texture_astc"),
bptc: gl.getExtension("EXT_texture_compression_bptc"),
rgtc: gl.getExtension("EXT_texture_compression_rgtc"),
loseContext: gl.getExtension("WEBGL_lose_context")
};
if (this.webGLVersion === 1) {
this.extensions = {
...common,
drawBuffers: gl.getExtension("WEBGL_draw_buffers"),
depthTexture: gl.getExtension("WEBGL_depth_texture"),
vertexArrayObject: gl.getExtension("OES_vertex_array_object") || gl.getExtension("MOZ_OES_vertex_array_object") || gl.getExtension("WEBKIT_OES_vertex_array_object"),
uint32ElementIndex: gl.getExtension("OES_element_index_uint"),
// Floats and half-floats
floatTexture: gl.getExtension("OES_texture_float"),
floatTextureLinear: gl.getExtension("OES_texture_float_linear"),
textureHalfFloat: gl.getExtension("OES_texture_half_float"),
textureHalfFloatLinear: gl.getExtension("OES_texture_half_float_linear"),
vertexAttribDivisorANGLE: gl.getExtension("ANGLE_instanced_arrays"),
srgb: gl.getExtension("EXT_sRGB")
};
} else {
this.extensions = {
...common,
colorBufferFloat: gl.getExtension("EXT_color_buffer_float")
};
const provokeExt = gl.getExtension("WEBGL_provoking_vertex");
if (provokeExt) {
provokeExt.provokingVertexWEBGL(provokeExt.FIRST_VERTEX_CONVENTION_WEBGL);
}
}
}
/**
* Handles a lost webgl context
* @param {WebGLContextEvent} event - The context lost event.
*/
handleContextLost(event) {
event.preventDefault();
if (this._contextLossForced) {
this._contextLossForced = false;
setTimeout(() => {
if (this.gl.isContextLost()) {
this.extensions.loseContext?.restoreContext();
}
}, 0);
}
}
/** Handles a restored webgl context. */
handleContextRestored() {
this._renderer.runners.contextChange.emit(this.gl);
}
destroy() {
const element = this._renderer.view.canvas;
this._renderer = null;
element.removeEventListener("webglcontextlost", this.handleContextLost);
element.removeEventListener("webglcontextrestored", this.handleContextRestored);
this.gl.useProgram(null);
this.extensions.loseContext?.loseContext();
}
/**
* this function can be called to force a webGL context loss
* this will release all resources on the GPU.
* Useful if you need to put Pixi to sleep, and save some GPU memory
*
* As soon as render is called - all resources will be created again.
*/
forceContextLoss() {
this.extensions.loseContext?.loseContext();
this._contextLossForced = true;
}
/**
* Validate context.
* @param {WebGLRenderingContext} gl - Render context.
*/
validateContext(gl) {
const attributes = gl.getContextAttributes();
if (attributes && !attributes.stencil) {
warn.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");
}
const supports = this.supports;
const isWebGl2 = this.webGLVersion === 2;
const extensions = this.extensions;
supports.uint32Indices = isWebGl2 || !!extensions.uint32ElementIndex;
supports.uniformBufferObject = isWebGl2;
supports.vertexArrayObject = isWebGl2 || !!extensions.vertexArrayObject;
supports.srgbTextures = isWebGl2 || !!extensions.srgb;
supports.nonPowOf2wrapping = isWebGl2;
supports.nonPowOf2mipmaps = isWebGl2;
supports.msaa = isWebGl2;
if (!supports.uint32Indices) {
warn.warn("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly");
}
}
};
/** @ignore */
_GlContextSystem.extension = {
type: [
Extensions.ExtensionType.WebGLSystem
],
name: "context"
};
/** The default options for the system. */
_GlContextSystem.defaultOptions = {
/**
* {@link WebGLOptions.context}
* @default null
*/
context: null,
/**
* {@link WebGLOptions.premultipliedAlpha}
* @default true
*/
premultipliedAlpha: true,
/**
* {@link WebGLOptions.preserveDrawingBuffer}
* @default false
*/
preserveDrawingBuffer: false,
/**
* {@link WebGLOptions.powerPreference}
* @default default
*/
powerPreference: void 0,
/**
* {@link WebGLOptions.webGLVersion}
* @default 2
*/
preferWebGLVersion: 2,
/**
* {@link WebGLOptions.multiView}
* @default false
*/
multiView: false
};
let GlContextSystem = _GlContextSystem;
exports.GlContextSystem = GlContextSystem;
//# sourceMappingURL=GlContextSystem.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,277 @@
import { DOMAdapter } from '../../../../environment/adapter.mjs';
import { ExtensionType } from '../../../../extensions/Extensions.mjs';
import { warn } from '../../../../utils/logging/warn.mjs';
"use strict";
const _GlContextSystem = class _GlContextSystem {
/** @param renderer - The renderer this System works for. */
constructor(renderer) {
/**
* Features supported by current renderer.
* @type {object}
* @readonly
*/
this.supports = {
/** Support for 32-bit indices buffer. */
uint32Indices: true,
/** Support for UniformBufferObjects */
uniformBufferObject: true,
/** Support for VertexArrayObjects */
vertexArrayObject: true,
/** Support for SRGB texture format */
srgbTextures: true,
/** Support for wrapping modes if a texture is non-power of two */
nonPowOf2wrapping: true,
/** Support for MSAA (antialiasing of dynamic textures) */
msaa: true,
/** Support for mipmaps if a texture is non-power of two */
nonPowOf2mipmaps: true
};
this._renderer = renderer;
this.extensions = /* @__PURE__ */ Object.create(null);
this.handleContextLost = this.handleContextLost.bind(this);
this.handleContextRestored = this.handleContextRestored.bind(this);
}
/**
* `true` if the context is lost
* @readonly
*/
get isLost() {
return !this.gl || this.gl.isContextLost();
}
/**
* Handles the context change event.
* @param {WebGLRenderingContext} gl - New WebGL context.
*/
contextChange(gl) {
this.gl = gl;
this._renderer.gl = gl;
}
init(options) {
options = { ..._GlContextSystem.defaultOptions, ...options };
let multiView = this.multiView = options.multiView;
if (options.context && multiView) {
warn("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together.");
multiView = false;
}
if (multiView) {
this.canvas = DOMAdapter.get().createCanvas(this._renderer.canvas.width, this._renderer.canvas.height);
} else {
this.canvas = this._renderer.view.canvas;
}
if (options.context) {
this.initFromContext(options.context);
} else {
const alpha = this._renderer.background.alpha < 1;
const premultipliedAlpha = options.premultipliedAlpha ?? true;
const antialias = options.antialias && !this._renderer.backBuffer.useBackBuffer;
this.createContext(options.preferWebGLVersion, {
alpha,
premultipliedAlpha,
antialias,
stencil: true,
preserveDrawingBuffer: options.preserveDrawingBuffer,
powerPreference: options.powerPreference ?? "default"
});
}
}
ensureCanvasSize(targetCanvas) {
if (!this.multiView) {
if (targetCanvas !== this.canvas) {
warn("multiView is disabled, but targetCanvas is not the main canvas");
}
return;
}
const { canvas } = this;
if (canvas.width < targetCanvas.width || canvas.height < targetCanvas.height) {
canvas.width = Math.max(targetCanvas.width, targetCanvas.width);
canvas.height = Math.max(targetCanvas.height, targetCanvas.height);
}
}
/**
* Initializes the context.
* @protected
* @param {WebGLRenderingContext} gl - WebGL context
*/
initFromContext(gl) {
this.gl = gl;
this.webGLVersion = gl instanceof DOMAdapter.get().getWebGLRenderingContext() ? 1 : 2;
this.getExtensions();
this.validateContext(gl);
this._renderer.runners.contextChange.emit(gl);
const element = this._renderer.view.canvas;
element.addEventListener("webglcontextlost", this.handleContextLost, false);
element.addEventListener("webglcontextrestored", this.handleContextRestored, false);
}
/**
* Initialize from context options
* @protected
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
* @param preferWebGLVersion
* @param {object} options - context attributes
*/
createContext(preferWebGLVersion, options) {
let gl;
const canvas = this.canvas;
if (preferWebGLVersion === 2) {
gl = canvas.getContext("webgl2", options);
}
if (!gl) {
gl = canvas.getContext("webgl", options);
if (!gl) {
throw new Error("This browser does not support WebGL. Try using the canvas renderer");
}
}
this.gl = gl;
this.initFromContext(this.gl);
}
/** Auto-populate the {@link GlContextSystem.extensions extensions}. */
getExtensions() {
const { gl } = this;
const common = {
anisotropicFiltering: gl.getExtension("EXT_texture_filter_anisotropic"),
floatTextureLinear: gl.getExtension("OES_texture_float_linear"),
s3tc: gl.getExtension("WEBGL_compressed_texture_s3tc"),
s3tc_sRGB: gl.getExtension("WEBGL_compressed_texture_s3tc_srgb"),
// eslint-disable-line camelcase
etc: gl.getExtension("WEBGL_compressed_texture_etc"),
etc1: gl.getExtension("WEBGL_compressed_texture_etc1"),
pvrtc: gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
atc: gl.getExtension("WEBGL_compressed_texture_atc"),
astc: gl.getExtension("WEBGL_compressed_texture_astc"),
bptc: gl.getExtension("EXT_texture_compression_bptc"),
rgtc: gl.getExtension("EXT_texture_compression_rgtc"),
loseContext: gl.getExtension("WEBGL_lose_context")
};
if (this.webGLVersion === 1) {
this.extensions = {
...common,
drawBuffers: gl.getExtension("WEBGL_draw_buffers"),
depthTexture: gl.getExtension("WEBGL_depth_texture"),
vertexArrayObject: gl.getExtension("OES_vertex_array_object") || gl.getExtension("MOZ_OES_vertex_array_object") || gl.getExtension("WEBKIT_OES_vertex_array_object"),
uint32ElementIndex: gl.getExtension("OES_element_index_uint"),
// Floats and half-floats
floatTexture: gl.getExtension("OES_texture_float"),
floatTextureLinear: gl.getExtension("OES_texture_float_linear"),
textureHalfFloat: gl.getExtension("OES_texture_half_float"),
textureHalfFloatLinear: gl.getExtension("OES_texture_half_float_linear"),
vertexAttribDivisorANGLE: gl.getExtension("ANGLE_instanced_arrays"),
srgb: gl.getExtension("EXT_sRGB")
};
} else {
this.extensions = {
...common,
colorBufferFloat: gl.getExtension("EXT_color_buffer_float")
};
const provokeExt = gl.getExtension("WEBGL_provoking_vertex");
if (provokeExt) {
provokeExt.provokingVertexWEBGL(provokeExt.FIRST_VERTEX_CONVENTION_WEBGL);
}
}
}
/**
* Handles a lost webgl context
* @param {WebGLContextEvent} event - The context lost event.
*/
handleContextLost(event) {
event.preventDefault();
if (this._contextLossForced) {
this._contextLossForced = false;
setTimeout(() => {
if (this.gl.isContextLost()) {
this.extensions.loseContext?.restoreContext();
}
}, 0);
}
}
/** Handles a restored webgl context. */
handleContextRestored() {
this._renderer.runners.contextChange.emit(this.gl);
}
destroy() {
const element = this._renderer.view.canvas;
this._renderer = null;
element.removeEventListener("webglcontextlost", this.handleContextLost);
element.removeEventListener("webglcontextrestored", this.handleContextRestored);
this.gl.useProgram(null);
this.extensions.loseContext?.loseContext();
}
/**
* this function can be called to force a webGL context loss
* this will release all resources on the GPU.
* Useful if you need to put Pixi to sleep, and save some GPU memory
*
* As soon as render is called - all resources will be created again.
*/
forceContextLoss() {
this.extensions.loseContext?.loseContext();
this._contextLossForced = true;
}
/**
* Validate context.
* @param {WebGLRenderingContext} gl - Render context.
*/
validateContext(gl) {
const attributes = gl.getContextAttributes();
if (attributes && !attributes.stencil) {
warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");
}
const supports = this.supports;
const isWebGl2 = this.webGLVersion === 2;
const extensions = this.extensions;
supports.uint32Indices = isWebGl2 || !!extensions.uint32ElementIndex;
supports.uniformBufferObject = isWebGl2;
supports.vertexArrayObject = isWebGl2 || !!extensions.vertexArrayObject;
supports.srgbTextures = isWebGl2 || !!extensions.srgb;
supports.nonPowOf2wrapping = isWebGl2;
supports.nonPowOf2mipmaps = isWebGl2;
supports.msaa = isWebGl2;
if (!supports.uint32Indices) {
warn("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly");
}
}
};
/** @ignore */
_GlContextSystem.extension = {
type: [
ExtensionType.WebGLSystem
],
name: "context"
};
/** The default options for the system. */
_GlContextSystem.defaultOptions = {
/**
* {@link WebGLOptions.context}
* @default null
*/
context: null,
/**
* {@link WebGLOptions.premultipliedAlpha}
* @default true
*/
premultipliedAlpha: true,
/**
* {@link WebGLOptions.preserveDrawingBuffer}
* @default false
*/
preserveDrawingBuffer: false,
/**
* {@link WebGLOptions.powerPreference}
* @default default
*/
powerPreference: void 0,
/**
* {@link WebGLOptions.webGLVersion}
* @default 2
*/
preferWebGLVersion: 2,
/**
* {@link WebGLOptions.multiView}
* @default false
*/
multiView: false
};
let GlContextSystem = _GlContextSystem;
export { GlContextSystem };
//# sourceMappingURL=GlContextSystem.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export type GlRenderingContext = WebGL2RenderingContext;

View File

@@ -0,0 +1,4 @@
'use strict';
"use strict";
//# sourceMappingURL=GlRenderingContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"GlRenderingContext.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}

View File

@@ -0,0 +1,2 @@
"use strict";
//# sourceMappingURL=GlRenderingContext.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"GlRenderingContext.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}

View File

@@ -0,0 +1,62 @@
export interface WEBGL_compressed_texture_pvrtc {
COMPRESSED_RGB_PVRTC_4BPPV1_IMG: number;
COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: number;
COMPRESSED_RGB_PVRTC_2BPPV1_IMG: number;
COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: number;
}
export interface WEBGL_compressed_texture_etc {
COMPRESSED_R11_EAC: number;
COMPRESSED_SIGNED_R11_EAC: number;
COMPRESSED_RG11_EAC: number;
COMPRESSED_SIGNED_RG11_EAC: number;
COMPRESSED_RGB8_ETC2: number;
COMPRESSED_RGBA8_ETC2_EAC: number;
COMPRESSED_SRGB8_ETC2: number;
COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: number;
COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: number;
COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: number;
}
export interface WEBGL_compressed_texture_etc1 {
COMPRESSED_RGB_ETC1_WEBGL: number;
}
export interface WEBGL_compressed_texture_atc {
COMPRESSED_RGB_ATC_WEBGL: number;
COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: number;
COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: number;
}
export interface EXT_texture_compression_bptc {
COMPRESSED_RGBA_BPTC_UNORM_EXT: number;
COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: number;
COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: number;
COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: number;
}
export interface EXT_texture_compression_rgtc {
COMPRESSED_RED_RGTC1_EXT: number;
COMPRESSED_SIGNED_RED_RGTC1_EXT: number;
COMPRESSED_RED_GREEN_RGTC2_EXT: number;
COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: number;
}
export interface WebGLExtensions {
drawBuffers?: WEBGL_draw_buffers;
depthTexture?: OES_texture_float;
loseContext?: WEBGL_lose_context;
vertexArrayObject?: OES_vertex_array_object;
anisotropicFiltering?: EXT_texture_filter_anisotropic;
uint32ElementIndex?: OES_element_index_uint;
floatTexture?: OES_texture_float;
floatTextureLinear?: OES_texture_float_linear;
textureHalfFloat?: OES_texture_half_float;
textureHalfFloatLinear?: OES_texture_half_float_linear;
colorBufferFloat?: EXT_color_buffer_float;
vertexAttribDivisorANGLE?: ANGLE_instanced_arrays;
s3tc?: WEBGL_compressed_texture_s3tc;
s3tc_sRGB?: WEBGL_compressed_texture_s3tc_srgb;
etc?: WEBGL_compressed_texture_etc;
etc1?: WEBGL_compressed_texture_etc1;
pvrtc?: WEBGL_compressed_texture_pvrtc;
atc?: WEBGL_compressed_texture_atc;
astc?: WEBGL_compressed_texture_astc;
bptc?: EXT_texture_compression_bptc;
rgtc?: EXT_texture_compression_rgtc;
srgb?: EXT_sRGB;
}

View File

@@ -0,0 +1,4 @@
'use strict';
"use strict";
//# sourceMappingURL=WebGLExtensions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"WebGLExtensions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}

View File

@@ -0,0 +1,2 @@
"use strict";
//# sourceMappingURL=WebGLExtensions.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"WebGLExtensions.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}