@luma.gl/core
Advanced tools
Comparing version 9.0.0-alpha.35 to 9.0.0-alpha.36
import type { ShaderLayout } from '../types/shader-layout'; | ||
import type { BufferLayout } from '../types/buffer-layout'; | ||
import type { ShaderDataType, ShaderAttributeType } from '../types/shader-formats'; | ||
import type { ShaderDataType, ShaderAttributeType } from '../types/shader-types'; | ||
import type { VertexFormat, VertexType } from '../types/vertex-formats'; | ||
@@ -36,4 +36,12 @@ /** Resolved info for a buffer / attribute combination to help backend configure it correctly */ | ||
}; | ||
/** | ||
* Map from "attribute names" to "resolved attribute infos" | ||
* containing information about both buffer layouts and shader attribute declarations | ||
*/ | ||
export declare function getAttributeInfosFromLayouts(shaderLayout: ShaderLayout, bufferLayout: BufferLayout[]): Record<string, AttributeInfo>; | ||
/** | ||
* Array indexed by "location" holding "resolved attribute infos" | ||
*/ | ||
export declare function getAttributeInfosByLocation(shaderLayout: ShaderLayout, bufferLayout: BufferLayout[], maxVertexAttributes?: number): AttributeInfo[]; | ||
/** | ||
* Merges an provided shader layout into a base shader layout | ||
@@ -40,0 +48,0 @@ * In WebGL, this allows the auto generated shader layout to be overridden by the application |
@@ -11,2 +11,11 @@ import { log } from "../../lib/utils/log.js"; | ||
} | ||
export function getAttributeInfosByLocation(shaderLayout, bufferLayout) { | ||
let maxVertexAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 16; | ||
const attributeInfos = getAttributeInfosFromLayouts(shaderLayout, bufferLayout); | ||
const locationInfos = new Array(maxVertexAttributes).fill(null); | ||
for (const attributeInfo of Object.values(attributeInfos)) { | ||
locationInfos[attributeInfo.location] = attributeInfo; | ||
} | ||
return locationInfos; | ||
} | ||
function getAttributeInfoFromLayouts(shaderLayout, bufferLayout, name) { | ||
@@ -13,0 +22,0 @@ const shaderDeclaration = getAttributeFromShaderLayout(shaderLayout, name); |
@@ -16,2 +16,3 @@ import { StatsManager } from '../lib/utils/stats-manager'; | ||
import type { CommandEncoder, CommandEncoderProps } from './resources/command-encoder'; | ||
import type { VertexArray, VertexArrayProps } from './resources/vertex-array'; | ||
/** Device properties */ | ||
@@ -69,3 +70,3 @@ export type DeviceProps = { | ||
readonly maxVertexBuffers?: number; | ||
readonly maxVertexAttributes?: number; | ||
readonly maxVertexAttributes: number; | ||
readonly maxVertexBufferArrayStride?: number; | ||
@@ -156,2 +157,4 @@ readonly maxInterStageShaderComponents?: number; | ||
createCommandEncoder(props?: CommandEncoderProps): CommandEncoder; | ||
/** Create a vertex array */ | ||
abstract createVertexArray(props: VertexArrayProps): VertexArray; | ||
/** Create a RenderPass */ | ||
@@ -158,0 +161,0 @@ abstract beginRenderPass(props?: RenderPassProps): RenderPass; |
@@ -26,5 +26,9 @@ import { TypedArray } from '../..'; | ||
static COPY_DST: number; | ||
/** Index buffer */ | ||
static INDEX: number; | ||
/** Vertex buffer */ | ||
static VERTEX: number; | ||
/** Uniform buffer */ | ||
static UNIFORM: number; | ||
/** Storage buffer */ | ||
static STORAGE: number; | ||
@@ -31,0 +35,0 @@ static INDIRECT: number; |
@@ -5,3 +5,3 @@ import type { Device } from '../device'; | ||
import { Framebuffer } from './framebuffer'; | ||
import { NumericArray } from '../..'; | ||
import { NumberArray } from '../..'; | ||
/** | ||
@@ -16,3 +16,3 @@ * Properties for a RenderPass instance is a required parameter to all draw calls. | ||
/** Clear value for color attachment, or `load` to preserve the previous value */ | ||
clearColor?: NumericArray | false; | ||
clearColor?: NumberArray | false; | ||
/** Clear value for depth attachment, or `load` to preserve the previous value */ | ||
@@ -19,0 +19,0 @@ clearDepth?: number | false; |
import type { Device } from '../device'; | ||
import type { TypedArray } from '../../types'; | ||
import type { UniformValue } from '../types/types'; | ||
@@ -8,5 +7,5 @@ import type { PrimitiveTopology, RenderPipelineParameters } from '../types/parameters'; | ||
import { Resource, ResourceProps } from './resource'; | ||
import type { Buffer } from './buffer'; | ||
import type { Shader } from './shader'; | ||
import type { RenderPass } from './render-pass'; | ||
import { VertexArray } from './vertex-array'; | ||
export type RenderPipelineProps = ResourceProps & { | ||
@@ -40,6 +39,2 @@ /** Compiled vertex shader */ | ||
instanceCount?: number; | ||
/** Optional index buffer */ | ||
indices?: Buffer | null; | ||
/** Buffers for attributes */ | ||
attributes?: Record<string, Buffer>; | ||
/** Buffers, Textures, Samplers for the shader bindings */ | ||
@@ -57,11 +52,9 @@ bindings?: Record<string, Binding>; | ||
hash: string; | ||
abstract vs: Shader; | ||
abstract fs: Shader | null; | ||
abstract readonly vs: Shader; | ||
abstract readonly fs: Shader | null; | ||
/** The merged layout */ | ||
shaderLayout: ShaderLayout; | ||
/** Buffer map describing buffer interleaving etc */ | ||
readonly bufferLayout: BufferLayout[]; | ||
constructor(device: Device, props: RenderPipelineProps); | ||
/** Set attributes (stored on pipeline and set before each call) */ | ||
abstract setIndexBuffer(indices: Buffer | null): void; | ||
/** Set attributes (stored on pipeline and set before each call) */ | ||
abstract setAttributes(attributes: Record<string, Buffer>): void; | ||
/** Set constant attributes (WebGL only) */ | ||
abstract setConstantAttributes(attributes: Record<string, TypedArray>): void; | ||
/** Set bindings (stored on pipeline and set before each call) */ | ||
@@ -79,2 +72,4 @@ abstract setBindings(bindings: Record<string, Binding>): void; | ||
renderPass?: RenderPass; | ||
/** vertex attributes */ | ||
vertexArray: VertexArray; | ||
/** Number of "rows" in 'vertex' buffers */ | ||
@@ -81,0 +76,0 @@ vertexCount?: number; |
@@ -13,2 +13,6 @@ let _Symbol$toStringTag; | ||
this.fs = void 0; | ||
this.shaderLayout = void 0; | ||
this.bufferLayout = void 0; | ||
this.shaderLayout = this.props.shaderLayout; | ||
this.bufferLayout = this.props.bufferLayout || []; | ||
} | ||
@@ -30,4 +34,2 @@ } | ||
instanceCount: 0, | ||
indices: null, | ||
attributes: {}, | ||
bindings: {}, | ||
@@ -34,0 +36,0 @@ uniforms: {} |
import type { Device } from '../device'; | ||
import { Resource, ResourceProps } from './resource'; | ||
export type CompilerMessageType = 'error' | 'warning' | 'info'; | ||
export type CompilerMessage = { | ||
type: CompilerMessageType; | ||
message: string; | ||
lineNum: number; | ||
linePos: number; | ||
}; | ||
import { CompilerMessage } from '../../lib/compiler-log/compiler-message'; | ||
/** | ||
@@ -17,3 +11,3 @@ * Properties for a Shader | ||
sourceMap?: string | null; | ||
language?: 'glsl' | 'wgsl'; | ||
language?: 'glsl' | 'wgsl' | 'auto'; | ||
/** @deprecated use props.stage */ | ||
@@ -20,0 +14,0 @@ shaderType?: 0x8b30 | 0x8b31 | 0; |
@@ -21,5 +21,5 @@ let _Symbol$toStringTag; | ||
sourceMap: null, | ||
language: 'glsl', | ||
language: 'auto', | ||
shaderType: 0 | ||
}; | ||
//# sourceMappingURL=shader.js.map |
@@ -1,2 +0,2 @@ | ||
import { ShaderDataType, ShaderAttributeType } from '../types/shader-formats'; | ||
import { ShaderDataType, ShaderAttributeType } from '../types/shader-types'; | ||
import { VertexFormat } from '../types/vertex-formats'; | ||
@@ -3,0 +3,0 @@ /** Information extracted from a ShaderAttributeInfo constant */ |
@@ -1,4 +0,4 @@ | ||
import { ShaderAttributeType } from '../types/shader-formats'; | ||
import { ShaderAttributeType } from '../types/shader-types'; | ||
/** Predeclared aliases @see https://www.w3.org/TR/WGSL/#vector-types */ | ||
export declare const WGSL_TYPE_ALIAS_MAP: Record<string, ShaderAttributeType>; | ||
//# sourceMappingURL=wgsl-utils.d.ts.map |
import type { TextureFormat } from '../types/texture-formats'; | ||
import type { ShaderUniformType, ShaderAttributeType } from './shader-formats'; | ||
import type { ShaderUniformType, ShaderAttributeType } from './shader-types'; | ||
import { AccessorObject } from '../types/accessor'; | ||
@@ -4,0 +4,0 @@ import type { Buffer } from '../resources/buffer'; |
@@ -1,2 +0,2 @@ | ||
import { NumericArray } from '../../types'; | ||
import { NumberArray } from '../../types'; | ||
import type { ColorTextureFormat, DepthStencilTextureFormat, TextureFormat } from './texture-formats'; | ||
@@ -6,3 +6,3 @@ import type { Buffer } from '../resources/buffer'; | ||
/** Valid values for uniforms. @note boolean values get converted to 0 or 1 before setting */ | ||
export type UniformValue = number | boolean | Float32Array | Int32Array | Uint32Array | NumericArray; | ||
export type UniformValue = number | boolean | Readonly<NumberArray>; | ||
/** Buffer bindings */ | ||
@@ -9,0 +9,0 @@ export type Binding = Texture | Buffer | { |
export { VERSION } from './init'; | ||
export type { ConstructorOf, PartialBy } from './types'; | ||
export type { TypedArray, TypedArrayConstructor, NumberArray, NumericArray, BigIntOrNumberArray, BigIntOrNumericArray } from './types'; | ||
export type { TypedArray, TypedArrayConstructor, NumberArray, BigIntOrNumberArray } from './types'; | ||
export { isTypedArray, isNumberArray } from './lib/utils/is-array'; | ||
export { luma } from './lib/luma'; | ||
@@ -35,2 +36,4 @@ export type { DeviceProps, DeviceLimits, DeviceInfo, DeviceFeature } from './adapter/device'; | ||
export { CommandBuffer } from './adapter/resources/command-buffer'; | ||
export type { VertexArrayProps } from './adapter/resources/vertex-array'; | ||
export { VertexArray } from './adapter/resources/vertex-array'; | ||
export type { AccessorObject } from './adapter/types/accessor'; | ||
@@ -40,3 +43,3 @@ export type { Parameters, PrimitiveTopology, IndexFormat, CullMode, FrontFace, RasterizationParameters, CompareFunction, StencilOperation, DepthStencilParameters, BlendFactor, BlendOperation, ColorParameters, MultisampleParameters, RenderPassParameters, RenderPipelineParameters } from './adapter/types/parameters'; | ||
export type { TextureFormat, ColorTextureFormat, DepthStencilTextureFormat } from './adapter/types/texture-formats'; | ||
export type { ShaderDataType, ShaderAttributeType, ShaderUniformType } from './adapter/types/shader-formats'; | ||
export type { ShaderDataType, ShaderAttributeType, ShaderUniformType } from './adapter/types/shader-types'; | ||
export type { ColorAttachment, DepthStencilAttachment } from './adapter/types/types'; | ||
@@ -47,7 +50,8 @@ export type { ShaderLayout, AttributeDeclaration, BindingDeclaration, Binding } from './adapter/types/shader-layout'; | ||
export type { UniformValue } from './adapter/types/types'; | ||
export { UniformBufferLayout } from './lib/uniform-buffer-layout'; | ||
export { UniformBlock } from './lib/uniform-block'; | ||
export { UniformBufferLayout } from './lib/uniforms/uniform-buffer-layout'; | ||
export { UniformBlock } from './lib/uniforms/uniform-block'; | ||
export { UniformStore } from './lib/uniforms/uniform-store'; | ||
export { decodeVertexFormat } from './adapter/type-utils/decode-vertex-format'; | ||
export { decodeTextureFormat } from './adapter/type-utils/decode-texture-format'; | ||
export { decodeShaderUniformType } from './adapter/type-utils/decode-uniform-type'; | ||
export { decodeShaderUniformType } from './adapter/type-utils/decode-shader-types'; | ||
export { decodeShaderAttributeType } from './adapter/type-utils/decode-attribute-type'; | ||
@@ -68,3 +72,3 @@ export type { CompilerMessage } from './lib/compiler-log/compiler-message'; | ||
export { getScratchArrayBuffer, getScratchArray, fillArray } from './lib/utils/array-utils-flat'; | ||
export { getRandom, random } from './lib/utils/random'; | ||
export { makeRandomNumberGenerator, random } from './lib/utils/random'; | ||
export { deepEqual } from './lib/utils/deep-equal'; | ||
@@ -71,0 +75,0 @@ export { requestAnimationFrame, cancelAnimationFrame } from './lib/request-animation-frame'; |
export { VERSION } from "./init.js"; | ||
export { isTypedArray, isNumberArray } from "./lib/utils/is-array.js"; | ||
export { luma } from "./lib/luma.js"; | ||
@@ -18,7 +19,9 @@ export { Device } from "./adapter/device.js"; | ||
export { CommandBuffer } from "./adapter/resources/command-buffer.js"; | ||
export { UniformBufferLayout } from "./lib/uniform-buffer-layout.js"; | ||
export { UniformBlock } from "./lib/uniform-block.js"; | ||
export { VertexArray } from "./adapter/resources/vertex-array.js"; | ||
export { UniformBufferLayout } from "./lib/uniforms/uniform-buffer-layout.js"; | ||
export { UniformBlock } from "./lib/uniforms/uniform-block.js"; | ||
export { UniformStore } from "./lib/uniforms/uniform-store.js"; | ||
export { decodeVertexFormat } from "./adapter/type-utils/decode-vertex-format.js"; | ||
export { decodeTextureFormat } from "./adapter/type-utils/decode-texture-format.js"; | ||
export { decodeShaderUniformType } from "./adapter/type-utils/decode-uniform-type.js"; | ||
export { decodeShaderUniformType } from "./adapter/type-utils/decode-shader-types.js"; | ||
export { decodeShaderAttributeType } from "./adapter/type-utils/decode-attribute-type.js"; | ||
@@ -37,3 +40,3 @@ export { formatCompilerLog } from "./lib/compiler-log/format-compiler-log.js"; | ||
export { getScratchArrayBuffer, getScratchArray, fillArray } from "./lib/utils/array-utils-flat.js"; | ||
export { getRandom, random } from "./lib/utils/random.js"; | ||
export { makeRandomNumberGenerator, random } from "./lib/utils/random.js"; | ||
export { deepEqual } from "./lib/utils/deep-equal.js"; | ||
@@ -40,0 +43,0 @@ export { requestAnimationFrame, cancelAnimationFrame } from "./lib/request-animation-frame.js"; |
/** Creates a deterministic pseudorandom number generator */ | ||
export declare function getRandom(): () => number; | ||
export declare function makeRandomNumberGenerator(): () => number; | ||
/** Generates a deterministic pseudorandom number */ | ||
export declare const random: () => number; | ||
//# sourceMappingURL=random.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export function getRandom() { | ||
export function makeRandomNumberGenerator() { | ||
let s = 1; | ||
@@ -13,3 +13,3 @@ let c = 1; | ||
} | ||
export const random = getRandom(); | ||
export const random = makeRandomNumberGenerator(); | ||
//# sourceMappingURL=random.js.map |
/** TypeScript type covering all typed arrays */ | ||
export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array; | ||
import { TypedArray, NumberArray } from '@math.gl/types'; | ||
export { TypedArray, NumberArray }; | ||
/** TypeScript type covering constructors of any of the typed arrays */ | ||
@@ -7,7 +8,3 @@ export type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Uint8ClampedArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor; | ||
export type BigIntTypedArray = BigInt64Array | BigUint64Array; | ||
/** type covering all typed arrays and classic arrays consisting of numbers */ | ||
export type NumberArray = number[] | TypedArray; | ||
export type NumericArray = number[] | TypedArray; | ||
export type BigIntOrNumberArray = NumberArray | BigIntTypedArray; | ||
export type BigIntOrNumericArray = NumberArray | BigIntTypedArray; | ||
/** Get the constructor type of a type */ | ||
@@ -14,0 +11,0 @@ export interface ConstructorOf<T> { |
@@ -1,2 +0,3 @@ | ||
export {}; | ||
import { TypedArray, NumberArray } from '@math.gl/types'; | ||
export { TypedArray, NumberArray }; | ||
//# sourceMappingURL=types.js.map |
{ | ||
"name": "@luma.gl/core", | ||
"version": "9.0.0-alpha.35", | ||
"version": "9.0.0-alpha.36", | ||
"description": "luma.gl API", | ||
@@ -45,3 +45,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "5b93557731aaf1b9fd0fc1d84b5a3c7c0717298a" | ||
"gitHead": "05d6f82f0006047f9a6a562a1da1011d3b6b15e3" | ||
} |
@@ -1,2 +0,2 @@ | ||
# @luma.gl/api | ||
# @luma.gl/core | ||
@@ -3,0 +3,0 @@ <h1 align="center">luma.gl | <a href="https://luma.gl">Docs</a></h1> |
@@ -6,3 +6,3 @@ // luma.gl, MIT license | ||
import type {BufferLayout} from '../types/buffer-layout'; | ||
import type {ShaderDataType, ShaderAttributeType} from '../types/shader-formats'; | ||
import type {ShaderDataType, ShaderAttributeType} from '../types/shader-types'; | ||
import {decodeShaderAttributeType} from '../type-utils/decode-attribute-type'; | ||
@@ -56,2 +56,6 @@ import type {VertexFormat, VertexType} from '../types/vertex-formats'; | ||
/** | ||
* Map from "attribute names" to "resolved attribute infos" | ||
* containing information about both buffer layouts and shader attribute declarations | ||
*/ | ||
export function getAttributeInfosFromLayouts( | ||
@@ -61,3 +65,3 @@ shaderLayout: ShaderLayout, | ||
): Record<string, AttributeInfo> { | ||
const attributeInfos: Record<string, ReturnType<typeof getAttributeInfoFromLayouts>> = {}; | ||
const attributeInfos: Record<string, AttributeInfo> = {}; | ||
for (const attribute of shaderLayout.attributes) { | ||
@@ -73,2 +77,18 @@ attributeInfos[attribute.name] = getAttributeInfoFromLayouts( | ||
/** | ||
* Array indexed by "location" holding "resolved attribute infos" | ||
*/ | ||
export function getAttributeInfosByLocation( | ||
shaderLayout: ShaderLayout, | ||
bufferLayout: BufferLayout[], | ||
maxVertexAttributes: number = 16 | ||
): AttributeInfo[] { | ||
const attributeInfos = getAttributeInfosFromLayouts(shaderLayout, bufferLayout); | ||
const locationInfos: AttributeInfo[] = new Array(maxVertexAttributes).fill(null); | ||
for (const attributeInfo of Object.values(attributeInfos)) { | ||
locationInfos[attributeInfo.location] = attributeInfo; | ||
} | ||
return locationInfos; | ||
} | ||
/** | ||
@@ -75,0 +95,0 @@ * Get the combined information from a shader layout and a buffer layout for a specific attribute |
@@ -20,2 +20,3 @@ // luma.gl, MIT license | ||
import type {CommandEncoder, CommandEncoderProps} from './resources/command-encoder'; | ||
import type {VertexArray, VertexArrayProps} from './resources/vertex-array'; | ||
@@ -118,3 +119,3 @@ /** Device properties */ | ||
readonly maxVertexBuffers?: number; | ||
readonly maxVertexAttributes?: number; | ||
readonly maxVertexAttributes: number; | ||
readonly maxVertexBufferArrayStride?: number; | ||
@@ -317,2 +318,5 @@ readonly maxInterStageShaderComponents?: number; | ||
/** Create a vertex array */ | ||
abstract createVertexArray(props: VertexArrayProps): VertexArray; | ||
/** Create a RenderPass */ | ||
@@ -319,0 +323,0 @@ abstract beginRenderPass(props?: RenderPassProps): RenderPass; |
@@ -41,5 +41,9 @@ // luma.gl, MIT license | ||
static COPY_DST = 0x0008; | ||
/** Index buffer */ | ||
static INDEX = 0x0010; | ||
/** Vertex buffer */ | ||
static VERTEX = 0x0020; | ||
/** Uniform buffer */ | ||
static UNIFORM = 0x0040; | ||
/** Storage buffer */ | ||
static STORAGE = 0x0080; | ||
@@ -46,0 +50,0 @@ static INDIRECT = 0x0100; |
@@ -10,3 +10,3 @@ // luma.gl, MIT license | ||
import {Framebuffer} from './framebuffer'; | ||
import {NumericArray} from '../..'; | ||
import {NumberArray} from '../..'; | ||
@@ -22,3 +22,3 @@ /** | ||
/** Clear value for color attachment, or `load` to preserve the previous value */ | ||
clearColor?: NumericArray | false; | ||
clearColor?: NumberArray | false; | ||
/** Clear value for depth attachment, or `load` to preserve the previous value */ | ||
@@ -25,0 +25,0 @@ clearDepth?: number | false; |
// luma.gl, MIT license | ||
import type {Device} from '../device'; | ||
import type {TypedArray} from '../../types'; | ||
import type {UniformValue} from '../types/types'; | ||
@@ -10,5 +9,5 @@ import type {PrimitiveTopology, RenderPipelineParameters} from '../types/parameters'; | ||
import {Resource, ResourceProps} from './resource'; | ||
import type {Buffer} from './buffer'; | ||
import type {Shader} from './shader'; | ||
import type {RenderPass} from './render-pass'; | ||
import {VertexArray} from './vertex-array'; | ||
@@ -52,6 +51,2 @@ export type RenderPipelineProps = ResourceProps & { | ||
/** Optional index buffer */ | ||
indices?: Buffer | null; | ||
/** Buffers for attributes */ | ||
attributes?: Record<string, Buffer>; | ||
/** Buffers, Textures, Samplers for the shader bindings */ | ||
@@ -86,4 +81,2 @@ bindings?: Record<string, Binding>; | ||
indices: null, | ||
attributes: {}, | ||
bindings: {}, | ||
@@ -96,15 +89,15 @@ uniforms: {} | ||
hash: string = ''; | ||
abstract vs: Shader; | ||
abstract fs: Shader | null; | ||
abstract readonly vs: Shader; | ||
abstract readonly fs: Shader | null; | ||
/** The merged layout */ | ||
shaderLayout: ShaderLayout; | ||
/** Buffer map describing buffer interleaving etc */ | ||
readonly bufferLayout: BufferLayout[]; | ||
constructor(device: Device, props: RenderPipelineProps) { | ||
super(device, props, RenderPipeline.defaultProps); | ||
this.shaderLayout = this.props.shaderLayout; | ||
this.bufferLayout = this.props.bufferLayout || []; | ||
} | ||
/** Set attributes (stored on pipeline and set before each call) */ | ||
abstract setIndexBuffer(indices: Buffer | null): void; | ||
/** Set attributes (stored on pipeline and set before each call) */ | ||
abstract setAttributes(attributes: Record<string, Buffer>): void; | ||
/** Set constant attributes (WebGL only) */ | ||
abstract setConstantAttributes(attributes: Record<string, TypedArray>): void; | ||
/** Set bindings (stored on pipeline and set before each call) */ | ||
@@ -123,2 +116,4 @@ abstract setBindings(bindings: Record<string, Binding>): void; | ||
renderPass?: RenderPass; | ||
/** vertex attributes */ | ||
vertexArray: VertexArray; | ||
/** Number of "rows" in 'vertex' buffers */ | ||
@@ -125,0 +120,0 @@ vertexCount?: number; |
// luma.gl, MIT license | ||
import type {Device} from '../device'; | ||
import {Resource, ResourceProps} from './resource'; | ||
import {CompilerMessage} from '../../lib/compiler-log/compiler-message'; | ||
export type CompilerMessageType = 'error' | 'warning' | 'info'; | ||
export type CompilerMessage = { | ||
type: CompilerMessageType; | ||
message: string; | ||
lineNum: number; | ||
linePos: number; | ||
} | ||
/** | ||
@@ -22,3 +14,3 @@ * Properties for a Shader | ||
sourceMap?: string | null; // WebGPU only | ||
language?: 'glsl' | 'wgsl'; // wgsl in WebGPU only | ||
language?: 'glsl' | 'wgsl' | 'auto'; // wgsl in WebGPU only | ||
// entryPoint?: string; | ||
@@ -41,6 +33,6 @@ | ||
sourceMap: null, | ||
language: 'glsl', | ||
language: 'auto', | ||
shaderType: 0 | ||
}; | ||
override get [Symbol.toStringTag](): string { return 'Shader'; } | ||
@@ -47,0 +39,0 @@ |
// luma.gl, MIT licese | ||
import {ShaderDataType, ShaderAttributeType} from '../types/shader-formats'; | ||
import {ShaderDataType, ShaderAttributeType} from '../types/shader-types'; | ||
import {VertexFormat, VertexType} from '../types/vertex-formats'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { ShaderAttributeType } from '../types/shader-formats'; | ||
import { ShaderAttributeType } from '../types/shader-types'; | ||
@@ -3,0 +3,0 @@ /** Predeclared aliases @see https://www.w3.org/TR/WGSL/#vector-types */ |
// luma.gl, MIT license | ||
import type {TextureFormat} from '../types/texture-formats'; | ||
import type {ShaderUniformType, ShaderAttributeType} from './shader-formats'; | ||
import type {ShaderUniformType, ShaderAttributeType} from './shader-types'; | ||
import {AccessorObject} from '../types/accessor'; | ||
@@ -5,0 +5,0 @@ import type {Buffer} from '../resources/buffer'; |
// luma.gl, MIT license | ||
import {NumericArray} from '../../types'; | ||
import {NumberArray} from '../../types'; | ||
import type {ColorTextureFormat, DepthStencilTextureFormat, TextureFormat} from './texture-formats'; | ||
@@ -10,3 +10,3 @@ import type {Buffer} from '../resources/buffer'; | ||
/** Valid values for uniforms. @note boolean values get converted to 0 or 1 before setting */ | ||
export type UniformValue = number | boolean | Float32Array | Int32Array | Uint32Array | NumericArray; | ||
export type UniformValue = number | boolean | Readonly<NumberArray>; // Float32Array> | Readonly<Int32Array> | Readonly<Uint32Array> | Readonly<number[]>; | ||
@@ -13,0 +13,0 @@ // BINDINGS |
@@ -13,7 +13,7 @@ // luma.gl, MIT license | ||
NumberArray, | ||
NumericArray, | ||
BigIntOrNumberArray, | ||
BigIntOrNumericArray | ||
BigIntOrNumberArray | ||
} from './types'; | ||
export {isTypedArray, isNumberArray} from './lib/utils/is-array'; | ||
// MAIN API ACCESS POINTS | ||
@@ -57,2 +57,5 @@ export {luma} from './lib/luma'; | ||
export type {VertexArrayProps} from './adapter/resources/vertex-array'; | ||
export {VertexArray} from './adapter/resources/vertex-array'; | ||
// API TYPES | ||
@@ -89,3 +92,3 @@ export type {AccessorObject} from './adapter/types/accessor'; | ||
ShaderUniformType | ||
} from './adapter/types/shader-formats'; | ||
} from './adapter/types/shader-types'; | ||
@@ -110,4 +113,5 @@ export type {ColorAttachment, DepthStencilAttachment} from './adapter/types/types'; | ||
export type {UniformValue} from './adapter/types/types'; | ||
export {UniformBufferLayout} from './lib/uniform-buffer-layout'; | ||
export {UniformBlock} from './lib/uniform-block'; | ||
export {UniformBufferLayout} from './lib/uniforms/uniform-buffer-layout'; | ||
export {UniformBlock} from './lib/uniforms/uniform-block'; | ||
export {UniformStore} from './lib/uniforms/uniform-store'; | ||
@@ -117,3 +121,5 @@ // TYPE UTILS | ||
export {decodeTextureFormat} from './adapter/type-utils/decode-texture-format'; | ||
export {decodeShaderUniformType} from './adapter/type-utils/decode-uniform-type'; | ||
// SHADER TYPE UTILS | ||
export {decodeShaderUniformType} from './adapter/type-utils/decode-shader-types'; | ||
export {decodeShaderAttributeType} from './adapter/type-utils/decode-attribute-type'; | ||
@@ -150,3 +156,3 @@ | ||
export {getScratchArrayBuffer, getScratchArray, fillArray} from './lib/utils/array-utils-flat'; | ||
export {getRandom, random} from './lib/utils/random'; | ||
export {makeRandomNumberGenerator, random} from './lib/utils/random'; | ||
export {deepEqual} from './lib/utils/deep-equal'; | ||
@@ -153,0 +159,0 @@ |
/** Creates a deterministic pseudorandom number generator */ | ||
export function getRandom(): () => number { | ||
export function makeRandomNumberGenerator(): () => number { | ||
let s = 1; | ||
@@ -17,2 +17,2 @@ let c = 1; | ||
/** Generates a deterministic pseudorandom number */ | ||
export const random = getRandom(); | ||
export const random = makeRandomNumberGenerator(); |
/** TypeScript type covering all typed arrays */ | ||
export type TypedArray = | ||
| Int8Array | ||
| Uint8Array | ||
| Int16Array | ||
| Uint16Array | ||
| Int32Array | ||
| Uint32Array | ||
| Uint8ClampedArray | ||
| Float32Array | ||
| Float64Array; | ||
import {TypedArray, NumberArray} from '@math.gl/types'; | ||
export {TypedArray, NumberArray}; | ||
/** TypeScript type covering constructors of any of the typed arrays */ | ||
@@ -28,8 +21,3 @@ export type TypedArrayConstructor = | ||
/** type covering all typed arrays and classic arrays consisting of numbers */ | ||
export type NumberArray = number[] | TypedArray; | ||
export type NumericArray = number[] | TypedArray; | ||
export type BigIntOrNumberArray = NumberArray | BigIntTypedArray; | ||
export type BigIntOrNumericArray = NumberArray | BigIntTypedArray; | ||
@@ -36,0 +24,0 @@ /** Get the constructor type of a type */ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
889302
281
13807