diff --git a/src/mol-gl/renderable/schema.ts b/src/mol-gl/renderable/schema.ts index 1595f4994ea98cd382fda47084a5983252e80431..4241121d240743d9e5da9392e7b129869e6c67e1 100644 --- a/src/mol-gl/renderable/schema.ts +++ b/src/mol-gl/renderable/schema.ts @@ -76,13 +76,15 @@ export function AttributeSpec<K extends AttributeKind>(kind: K, itemSize: Attrib return { type: 'attribute', kind, itemSize, divisor }; } -export type UniformSpec<K extends UniformKind> = { type: 'uniform', kind: K, variant?: 'material' | 'buffered' } -export function UniformSpec<K extends UniformKind>(kind: K, variant?: 'material' | 'buffered'): UniformSpec<K> { +type UniformVariant = 'material' | 'buffered' +export type UniformSpec<K extends UniformKind> = { type: 'uniform', kind: K, variant?: UniformVariant } +export function UniformSpec<K extends UniformKind>(kind: K, variant?: UniformVariant): UniformSpec<K> { return { type: 'uniform', kind, variant }; } -export type TextureSpec<K extends TextureKind> = { type: 'texture', kind: K, format: TextureFormat, dataType: TextureType, filter: TextureFilter, variant?: 'material' } -export function TextureSpec<K extends TextureKind>(kind: K, format: TextureFormat, dataType: TextureType, filter: TextureFilter, variant?: 'material'): TextureSpec<K> { +type TextureVariant = 'material' +export type TextureSpec<K extends TextureKind> = { type: 'texture', kind: K, format: TextureFormat, dataType: TextureType, filter: TextureFilter, variant?: TextureVariant } +export function TextureSpec<K extends TextureKind>(kind: K, format: TextureFormat, dataType: TextureType, filter: TextureFilter, variant?: TextureVariant): TextureSpec<K> { return { type: 'texture', kind, format, dataType, filter, variant }; } diff --git a/src/mol-gl/webgl/compat.ts b/src/mol-gl/webgl/compat.ts index 634849fede2c0432e1099809bc4d0a97e4308e69..d46f7e9b8de4c23803a9fa2a870ecc2545137aaa 100644 --- a/src/mol-gl/webgl/compat.ts +++ b/src/mol-gl/webgl/compat.ts @@ -23,8 +23,28 @@ export function isWebGL2(gl: any): gl is WebGL2RenderingContext { * See https://registry.khronos.org/webgl/extensions/ANGLE_instanced_arrays/ */ export interface COMPAT_instanced_arrays { + /** + * Renders primitives from array data like the `drawArrays` method. In addition, it can execute multiple instances of the range of elements. + * @param mode the type primitive to render. + * @param first the starting index in the array of vector points. + * @param count the number of indices to be rendered. + * @param primcount the number of instances of the range of elements to execute. + */ drawArraysInstanced(mode: number, first: number, count: number, primcount: number): void; + /** + * Renders primitives from array data like the `drawElements` method. In addition, it can execute multiple instances of a set of elements. + * @param mode the type primitive to render. + * @param count the number of elements to be rendered. + * @param type the type of the values in the element array buffer. + * @param offset an offset in the element array buffer. Must be a valid multiple of the size of the given `type`. + * @param primcount the number of instances of the set of elements to execute. + */ drawElementsInstanced(mode: number, count: number, type: number, offset: number, primcount: number): void; + /** + * Modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with `drawArraysInstanced` and `drawElementsInstanced` + * @param index the index of the generic vertex attributes. + * @param divisor the number of instances that will pass between updates of the generic attribute. + */ vertexAttribDivisor(index: number, divisor: number): void; readonly VERTEX_ATTRIB_ARRAY_DIVISOR: number; } @@ -109,6 +129,9 @@ export function getVertexArrayObject(gl: GLRenderingContext): COMPAT_vertex_arra } } +/** + * See https://registry.khronos.org/webgl/extensions/OES_texture_float/ + */ export interface COMPAT_texture_float { } @@ -116,6 +139,9 @@ export function getTextureFloat(gl: GLRenderingContext): COMPAT_texture_float | return isWebGL2(gl) ? {} : gl.getExtension('OES_texture_float'); } +/** + * See https://registry.khronos.org/webgl/extensions/OES_texture_float_linear/ + */ export interface COMPAT_texture_float_linear { } @@ -123,6 +149,9 @@ export function getTextureFloatLinear(gl: GLRenderingContext): COMPAT_texture_fl return gl.getExtension('OES_texture_float_linear'); } +/** + * See https://registry.khronos.org/webgl/extensions/OES_texture_half_float/ + */ export interface COMPAT_texture_half_float { readonly HALF_FLOAT: number } @@ -137,6 +166,9 @@ export function getTextureHalfFloat(gl: GLRenderingContext): COMPAT_texture_half } } +/** + * See https://registry.khronos.org/webgl/extensions/OES_texture_half_float_linear/ + */ export interface COMPAT_texture_half_float_linear { } @@ -172,6 +204,9 @@ export function getFragDepth(gl: GLRenderingContext): COMPAT_frag_depth | null { return isWebGL2(gl) ? {} : gl.getExtension('EXT_frag_depth'); } +/** + * See https://registry.khronos.org/webgl/extensions/EXT_color_buffer_float/ + */ export interface COMPAT_color_buffer_float { readonly RGBA32F: number; } @@ -193,6 +228,9 @@ export function getColorBufferFloat(gl: GLRenderingContext): COMPAT_color_buffer } } +/** + * See https://registry.khronos.org/webgl/extensions/EXT_color_buffer_half_float/ + */ export interface COMPAT_color_buffer_half_float { readonly RGBA16F: number; }