@luma.gl/engine 9.3.5 → 9.4.0-alpha.1
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.
- package/dist/animation/animator.d.ts +42 -0
- package/dist/animation/animator.d.ts.map +1 -0
- package/dist/animation/animator.js +53 -0
- package/dist/animation/animator.js.map +1 -0
- package/dist/animation-loop/animation-loop.d.ts +14 -2
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +40 -22
- package/dist/animation-loop/animation-loop.js.map +1 -1
- package/dist/animation-loop/animation-props.d.ts +2 -0
- package/dist/animation-loop/animation-props.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.d.ts +1 -0
- package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.js +3 -0
- package/dist/animation-loop/make-animation-loop.js.map +1 -1
- package/dist/application-utils/load-file.d.ts +2 -0
- package/dist/application-utils/load-file.d.ts.map +1 -1
- package/dist/application-utils/load-file.js +31 -5
- package/dist/application-utils/load-file.js.map +1 -1
- package/dist/compute/buffer-transform.d.ts +5 -1
- package/dist/compute/buffer-transform.d.ts.map +1 -1
- package/dist/compute/buffer-transform.js +7 -3
- package/dist/compute/buffer-transform.js.map +1 -1
- package/dist/compute/computation.d.ts +20 -8
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/compute/computation.js +34 -13
- package/dist/compute/computation.js.map +1 -1
- package/dist/compute/swap.d.ts.map +1 -1
- package/dist/compute/swap.js +17 -0
- package/dist/compute/swap.js.map +1 -1
- package/dist/dist.dev.js +4100 -1979
- package/dist/dist.min.js +288 -42
- package/dist/dynamic-buffer/dynamic-buffer.d.ts +171 -0
- package/dist/dynamic-buffer/dynamic-buffer.d.ts.map +1 -0
- package/dist/dynamic-buffer/dynamic-buffer.js +316 -0
- package/dist/dynamic-buffer/dynamic-buffer.js.map +1 -0
- package/dist/dynamic-texture/dynamic-texture.d.ts +14 -1
- package/dist/dynamic-texture/dynamic-texture.d.ts.map +1 -1
- package/dist/dynamic-texture/dynamic-texture.js +31 -2
- package/dist/dynamic-texture/dynamic-texture.js.map +1 -1
- package/dist/dynamic-texture/texture-binding-source.d.ts +55 -0
- package/dist/dynamic-texture/texture-binding-source.d.ts.map +1 -0
- package/dist/dynamic-texture/texture-binding-source.js +55 -0
- package/dist/dynamic-texture/texture-binding-source.js.map +1 -0
- package/dist/dynamic-texture/texture-data.d.ts +5 -3
- package/dist/dynamic-texture/texture-data.d.ts.map +1 -1
- package/dist/dynamic-texture/texture-data.js +5 -0
- package/dist/dynamic-texture/texture-data.js.map +1 -1
- package/dist/dynamic-texture/video-texture.d.ts +101 -0
- package/dist/dynamic-texture/video-texture.d.ts.map +1 -0
- package/dist/dynamic-texture/video-texture.js +272 -0
- package/dist/dynamic-texture/video-texture.js.map +1 -0
- package/dist/geometries/cube-geometry.d.ts +1 -0
- package/dist/geometries/cube-geometry.d.ts.map +1 -1
- package/dist/geometries/cube-geometry.js +22 -2
- package/dist/geometries/cube-geometry.js.map +1 -1
- package/dist/geometries/plane-geometry.d.ts +10 -0
- package/dist/geometries/plane-geometry.d.ts.map +1 -1
- package/dist/geometries/plane-geometry.js.map +1 -1
- package/dist/geometry/geometry-utils.d.ts +36 -1
- package/dist/geometry/geometry-utils.d.ts.map +1 -1
- package/dist/geometry/geometry-utils.js +137 -2
- package/dist/geometry/geometry-utils.js.map +1 -1
- package/dist/geometry/geometry.d.ts +52 -33
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +70 -19
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/geometry/gpu-geometry.d.ts +37 -4
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +44 -36
- package/dist/geometry/gpu-geometry.js.map +1 -1
- package/dist/index.cjs +3990 -1961
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +20 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/material/material-factory.d.ts +2 -1
- package/dist/material/material-factory.d.ts.map +1 -1
- package/dist/material/material-factory.js.map +1 -1
- package/dist/material/material.d.ts +29 -10
- package/dist/material/material.d.ts.map +1 -1
- package/dist/material/material.js +84 -21
- package/dist/material/material.js.map +1 -1
- package/dist/model/model.d.ts +81 -23
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +312 -78
- package/dist/model/model.js.map +1 -1
- package/dist/model/split-uniforms-and-bindings.d.ts +5 -2
- package/dist/model/split-uniforms-and-bindings.d.ts.map +1 -1
- package/dist/model/split-uniforms-and-bindings.js.map +1 -1
- package/dist/models/billboard-texture-model.d.ts +5 -2
- package/dist/models/billboard-texture-model.d.ts.map +1 -1
- package/dist/models/billboard-texture-model.js +28 -10
- package/dist/models/billboard-texture-model.js.map +1 -1
- package/dist/modules/picking/index-color-picking.d.ts +24 -0
- package/dist/modules/picking/index-color-picking.d.ts.map +1 -0
- package/dist/modules/picking/index-color-picking.js +205 -0
- package/dist/modules/picking/index-color-picking.js.map +1 -0
- package/dist/modules/picking/index-picking.d.ts +3 -3
- package/dist/modules/picking/index-picking.d.ts.map +1 -1
- package/dist/modules/picking/index-picking.js +23 -6
- package/dist/modules/picking/index-picking.js.map +1 -1
- package/dist/modules/picking/picking-manager.d.ts +21 -0
- package/dist/modules/picking/picking-manager.d.ts.map +1 -1
- package/dist/modules/picking/picking-manager.js +100 -0
- package/dist/modules/picking/picking-manager.js.map +1 -1
- package/dist/modules/picking/picking-uniforms.d.ts +4 -4
- package/dist/modules/picking/picking-uniforms.d.ts.map +1 -1
- package/dist/modules/picking/picking-uniforms.js +3 -0
- package/dist/modules/picking/picking-uniforms.js.map +1 -1
- package/dist/modules/picking/picking.d.ts +5 -1
- package/dist/modules/picking/picking.d.ts.map +1 -1
- package/dist/modules/picking/picking.js +6 -0
- package/dist/modules/picking/picking.js.map +1 -1
- package/dist/passes/get-fragment-shader.js +4 -4
- package/dist/passes/shader-pass-renderer.d.ts +92 -25
- package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
- package/dist/passes/shader-pass-renderer.js +466 -72
- package/dist/passes/shader-pass-renderer.js.map +1 -1
- package/dist/passes/texture-transform-module.d.ts +10 -0
- package/dist/passes/texture-transform-module.d.ts.map +1 -0
- package/dist/passes/texture-transform-module.js +50 -0
- package/dist/passes/texture-transform-module.js.map +1 -0
- package/dist/shader-inputs.d.ts +33 -16
- package/dist/shader-inputs.d.ts.map +1 -1
- package/dist/shader-inputs.js +42 -12
- package/dist/shader-inputs.js.map +1 -1
- package/dist/utils/buffer-layout-helper.d.ts +0 -1
- package/dist/utils/buffer-layout-helper.d.ts.map +1 -1
- package/dist/utils/buffer-layout-helper.js +2 -11
- package/dist/utils/buffer-layout-helper.js.map +1 -1
- package/dist/utils/buffer-layout-order.d.ts.map +1 -1
- package/dist/utils/buffer-layout-order.js +4 -15
- package/dist/utils/buffer-layout-order.js.map +1 -1
- package/dist/utils/shader-module-utils.d.ts +2 -0
- package/dist/utils/shader-module-utils.d.ts.map +1 -1
- package/dist/utils/shader-module-utils.js +64 -3
- package/dist/utils/shader-module-utils.js.map +1 -1
- package/package.json +2 -2
- package/src/animation/animator.ts +79 -0
- package/src/animation-loop/animation-loop.ts +56 -22
- package/src/animation-loop/animation-props.ts +2 -0
- package/src/animation-loop/make-animation-loop.ts +4 -0
- package/src/application-utils/load-file.ts +38 -5
- package/src/compute/buffer-transform.ts +14 -5
- package/src/compute/computation.ts +53 -21
- package/src/compute/swap.ts +19 -0
- package/src/dynamic-buffer/dynamic-buffer.ts +453 -0
- package/src/dynamic-texture/dynamic-texture.ts +36 -3
- package/src/dynamic-texture/texture-binding-source.ts +94 -0
- package/src/dynamic-texture/texture-data.ts +12 -4
- package/src/dynamic-texture/video-texture.ts +334 -0
- package/src/geometries/cube-geometry.ts +24 -2
- package/src/geometries/plane-geometry.ts +10 -0
- package/src/geometry/geometry-utils.ts +209 -4
- package/src/geometry/geometry.ts +113 -36
- package/src/geometry/gpu-geometry.ts +61 -41
- package/src/index.ts +50 -14
- package/src/material/material-factory.ts +5 -1
- package/src/material/material.ts +123 -27
- package/src/model/model.ts +441 -102
- package/src/model/split-uniforms-and-bindings.ts +7 -3
- package/src/models/billboard-texture-model.ts +33 -12
- package/src/modules/picking/index-color-picking.ts +212 -0
- package/src/modules/picking/index-picking.ts +23 -6
- package/src/modules/picking/picking-manager.ts +141 -0
- package/src/modules/picking/picking-uniforms.ts +7 -4
- package/src/modules/picking/picking.ts +8 -0
- package/src/passes/get-fragment-shader.ts +4 -4
- package/src/passes/shader-pass-renderer.ts +691 -89
- package/src/passes/texture-transform-module.ts +52 -0
- package/src/shader-inputs.ts +65 -17
- package/src/utils/buffer-layout-helper.ts +2 -14
- package/src/utils/buffer-layout-order.ts +14 -24
- package/src/utils/shader-module-utils.ts +109 -3
- package/dist/geometry/gpu-table.d.ts +0 -1
- package/dist/geometry/gpu-table.d.ts.map +0 -1
- package/dist/geometry/gpu-table.js +0 -46
- package/dist/geometry/gpu-table.js.map +0 -1
- package/src/dynamic-texture/texture-data.ts.disabled +0 -296
- package/src/geometry/gpu-table.ts +0 -45
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
// luma.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import type {Texture, TypedArray, TextureFormat, ExternalImage} from '@luma.gl/core';
|
|
6
|
-
import {isExternalImage, getExternalImageSize} from '@luma.gl/core';
|
|
7
|
-
|
|
8
|
-
/** Names of cube texture faces */
|
|
9
|
-
export type TextureCubeFace = '+X' | '-X' | '+Y' | '-Y' | '+Z' | '-Z';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* One mip level
|
|
13
|
-
* Basic data structure is similar to `ImageData`
|
|
14
|
-
* additional optional fields can describe compressed texture data.
|
|
15
|
-
*/
|
|
16
|
-
export type TextureLevelData = {
|
|
17
|
-
/** WebGPU style format string. Defaults to 'rgba8unorm' */
|
|
18
|
-
format?: TextureFormat;
|
|
19
|
-
data: TypedArray;
|
|
20
|
-
width: number;
|
|
21
|
-
height: number;
|
|
22
|
-
|
|
23
|
-
compressed?: boolean;
|
|
24
|
-
byteLength?: number;
|
|
25
|
-
hasAlpha?: boolean;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type TextureLevelSource = TextureLevelData | ExternalImage;
|
|
29
|
-
|
|
30
|
-
/** Texture data can be one or more mip levels */
|
|
31
|
-
export type TextureData = TextureLevelData | ExternalImage | (TextureLevelData | ExternalImage)[];
|
|
32
|
-
|
|
33
|
-
/** @todo - define what data type is supported for 1D textures */
|
|
34
|
-
export type Texture1DData = TypedArray | TextureLevelData;
|
|
35
|
-
|
|
36
|
-
/** Texture data can be one or more mip levels */
|
|
37
|
-
export type Texture2DData =
|
|
38
|
-
| TypedArray
|
|
39
|
-
| TextureLevelData
|
|
40
|
-
| ExternalImage
|
|
41
|
-
| (TextureLevelData | ExternalImage)[];
|
|
42
|
-
|
|
43
|
-
/** Array of textures */
|
|
44
|
-
export type Texture3DData = TypedArray | TextureData[];
|
|
45
|
-
|
|
46
|
-
/** 6 face textures */
|
|
47
|
-
export type TextureCubeData = Record<TextureCubeFace, Texture2DData>;
|
|
48
|
-
|
|
49
|
-
/** Array of textures */
|
|
50
|
-
export type TextureArrayData = TextureData[];
|
|
51
|
-
|
|
52
|
-
/** Array of 6 face textures */
|
|
53
|
-
export type TextureCubeArrayData = Record<TextureCubeFace, TextureData>[];
|
|
54
|
-
|
|
55
|
-
export type TextureDataProps =
|
|
56
|
-
| Texture1DProps
|
|
57
|
-
| Texture2DProps
|
|
58
|
-
| Texture3DProps
|
|
59
|
-
| TextureArrayProps
|
|
60
|
-
| TextureCubeProps
|
|
61
|
-
| TextureCubeArrayProps;
|
|
62
|
-
|
|
63
|
-
export type Texture1DProps = {dimension: '1d'; data?: Texture1DData | null};
|
|
64
|
-
export type Texture2DProps = {dimension?: '2d'; data?: Texture2DData | null};
|
|
65
|
-
export type Texture3DProps = {dimension: '3d'; data?: Texture3DData | null};
|
|
66
|
-
export type TextureArrayProps = {dimension: '2d-array'; data?: TextureArrayData | null};
|
|
67
|
-
export type TextureCubeProps = {dimension: 'cube'; data?: TextureCubeData | null};
|
|
68
|
-
export type TextureCubeArrayProps = {dimension: 'cube-array'; data: TextureCubeArrayData | null};
|
|
69
|
-
|
|
70
|
-
export const CubeFaces: TextureCubeFace[] = ['+X', '-X', '+Y', '-Y', '+Z', '-Z'];
|
|
71
|
-
|
|
72
|
-
/** Check if texture data is a typed array */
|
|
73
|
-
export function isTextureLevelData(data: TextureData): data is TextureLevelData {
|
|
74
|
-
const typedArray = (data as TextureLevelData)?.data;
|
|
75
|
-
return ArrayBuffer.isView(typedArray);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Get the size of the texture described by the provided TextureData */
|
|
79
|
-
export function getTextureDataSize(
|
|
80
|
-
data: TextureData | TextureCubeData | TextureArrayData | TextureCubeArrayData | TypedArray
|
|
81
|
-
): {width: number; height: number} | null {
|
|
82
|
-
if (!data) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
if (ArrayBuffer.isView(data)) {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
// Recurse into arrays (array of miplevels)
|
|
89
|
-
if (Array.isArray(data)) {
|
|
90
|
-
return getTextureDataSize(data[0]);
|
|
91
|
-
}
|
|
92
|
-
if (isExternalImage(data)) {
|
|
93
|
-
return getExternalImageSize(data);
|
|
94
|
-
}
|
|
95
|
-
if (data && typeof data === 'object' && data.constructor === Object) {
|
|
96
|
-
const textureDataArray = Object.values(data) as Texture2DData[];
|
|
97
|
-
const untypedData = textureDataArray[0] as any;
|
|
98
|
-
return {width: untypedData.width, height: untypedData.height};
|
|
99
|
-
}
|
|
100
|
-
throw new Error('texture size deduction failed');
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Normalize TextureData to an array of TextureLevelData / ExternalImages
|
|
105
|
-
* @param data
|
|
106
|
-
* @param options
|
|
107
|
-
* @returns array of TextureLevelData / ExternalImages
|
|
108
|
-
*/
|
|
109
|
-
export function normalizeTextureData(
|
|
110
|
-
data: Texture2DData,
|
|
111
|
-
options: {width: number; height: number; depth: number}
|
|
112
|
-
): (TextureLevelData | ExternalImage)[] {
|
|
113
|
-
let lodArray: (TextureLevelData | ExternalImage)[];
|
|
114
|
-
if (ArrayBuffer.isView(data)) {
|
|
115
|
-
lodArray = [
|
|
116
|
-
{
|
|
117
|
-
// ts-expect-error does data really need to be Uint8ClampedArray?
|
|
118
|
-
data,
|
|
119
|
-
width: options.width,
|
|
120
|
-
height: options.height
|
|
121
|
-
// depth: options.depth
|
|
122
|
-
}
|
|
123
|
-
];
|
|
124
|
-
} else if (!Array.isArray(data)) {
|
|
125
|
-
lodArray = [data];
|
|
126
|
-
} else {
|
|
127
|
-
lodArray = data;
|
|
128
|
-
}
|
|
129
|
-
return lodArray;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** Convert luma.gl cubemap face constants to depth index */
|
|
133
|
-
export function getCubeFaceDepth(face: TextureCubeFace): number {
|
|
134
|
-
// biome-ignore format: preserve layout
|
|
135
|
-
switch (face) {
|
|
136
|
-
case '+X': return 0;
|
|
137
|
-
case '-X': return 1;
|
|
138
|
-
case '+Y': return 2;
|
|
139
|
-
case '-Y': return 3;
|
|
140
|
-
case '+Z': return 4;
|
|
141
|
-
case '-Z': return 5;
|
|
142
|
-
default: throw new Error(face);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// EXPERIMENTAL
|
|
147
|
-
|
|
148
|
-
/** Set multiple mip levels */
|
|
149
|
-
export function setTexture1DData(texture: Texture, data: Texture1DData): void {
|
|
150
|
-
throw new Error('setTexture1DData not supported in WebGL.');
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** Set multiple mip levels */
|
|
154
|
-
export function setTexture2DData(texture: Texture, lodData: Texture2DData, depth = 0): void {
|
|
155
|
-
this.bind();
|
|
156
|
-
|
|
157
|
-
const lodArray = Texture.normalizeTextureData(lodData, this);
|
|
158
|
-
|
|
159
|
-
// If the user provides multiple LODs, then automatic mipmap
|
|
160
|
-
// generation generateMipmap() should be disabled to avoid overwriting them.
|
|
161
|
-
if (lodArray.length > 1 && this.props.mipmaps !== false) {
|
|
162
|
-
log.warn(`Texture ${this.id} mipmap and multiple LODs.`)();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
for (let lodLevel = 0; lodLevel < lodArray.length; lodLevel++) {
|
|
166
|
-
const imageData = lodArray[lodLevel];
|
|
167
|
-
this._setMipLevel(depth, lodLevel, imageData);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
this.unbind();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Sets 3D texture data: multiple depth slices, multiple mip levels
|
|
175
|
-
* @param data
|
|
176
|
-
*/
|
|
177
|
-
export function setTexture3DData(texture: Texture, data: Texture3DData): void {
|
|
178
|
-
if (this.props.dimension !== '3d') {
|
|
179
|
-
throw new Error(this.id);
|
|
180
|
-
}
|
|
181
|
-
if (ArrayBuffer.isView(data)) {
|
|
182
|
-
this.bind();
|
|
183
|
-
copyCPUDataToMipLevel(this.device.gl, data, this);
|
|
184
|
-
this.unbind();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Set Cube texture data, multiple faces, multiple mip levels
|
|
190
|
-
* @todo - could support TextureCubeArray with depth
|
|
191
|
-
* @param data
|
|
192
|
-
* @param index
|
|
193
|
-
*/
|
|
194
|
-
export function setTextureCubeData(texture: Texture, data: TextureCubeData): void {
|
|
195
|
-
if (this.props.dimension !== 'cube') {
|
|
196
|
-
throw new Error(this.id);
|
|
197
|
-
}
|
|
198
|
-
for (const face of Texture.CubeFaces) {
|
|
199
|
-
this.setTextureCubeFaceData(data[face], face);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Sets texture array data, multiple levels, multiple depth slices
|
|
205
|
-
* @param data
|
|
206
|
-
*/
|
|
207
|
-
export function setTextureArrayData(texture: Texture, data: TextureArrayData): void {
|
|
208
|
-
if (this.props.dimension !== '2d-array') {
|
|
209
|
-
throw new Error(this.id);
|
|
210
|
-
}
|
|
211
|
-
throw new Error('setTextureArrayData not implemented.');
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Sets texture cube array, multiple faces, multiple levels, multiple mip levels
|
|
216
|
-
* @param data
|
|
217
|
-
*/
|
|
218
|
-
export function setTextureCubeArrayData(texture: Texture, data: TextureCubeArrayData): void {
|
|
219
|
-
throw new Error('setTextureCubeArrayData not supported in WebGL2.');
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export function setTextureCubeFaceData(
|
|
223
|
-
texture: Texture,
|
|
224
|
-
lodData: Texture2DData,
|
|
225
|
-
face: TextureCubeFace,
|
|
226
|
-
depth: number = 0
|
|
227
|
-
): void {
|
|
228
|
-
// assert(this.props.dimension === 'cube');
|
|
229
|
-
|
|
230
|
-
// If the user provides multiple LODs, then automatic mipmap
|
|
231
|
-
// generation generateMipmap() should be disabled to avoid overwriting them.
|
|
232
|
-
if (Array.isArray(lodData) && lodData.length > 1 && this.props.mipmaps !== false) {
|
|
233
|
-
log.warn(`${this.id} has mipmap and multiple LODs.`)();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
const faceDepth = Texture.CubeFaces.indexOf(face);
|
|
237
|
-
|
|
238
|
-
this.setTexture2DData(lodData, faceDepth);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// TODO - Remove when texture refactor is complete
|
|
242
|
-
|
|
243
|
-
/*
|
|
244
|
-
setCubeMapData(options: {
|
|
245
|
-
width: number;
|
|
246
|
-
height: number;
|
|
247
|
-
data: Record<GL, Texture2DData> | Record<TextureCubeFace, Texture2DData>;
|
|
248
|
-
format?: any;
|
|
249
|
-
type?: any;
|
|
250
|
-
/** @deprecated Use .data *
|
|
251
|
-
pixels: any;
|
|
252
|
-
}): void {
|
|
253
|
-
const {gl} = this;
|
|
254
|
-
|
|
255
|
-
const {width, height, pixels, data, format = GL.RGBA, type = GL.UNSIGNED_BYTE} = options;
|
|
256
|
-
|
|
257
|
-
// pixel data (imageDataMap) is an Object from Face to Image or Promise.
|
|
258
|
-
// For example:
|
|
259
|
-
// {
|
|
260
|
-
// GL.TEXTURE_CUBE_MAP_POSITIVE_X : Image-or-Promise,
|
|
261
|
-
// GL.TEXTURE_CUBE_MAP_NEGATIVE_X : Image-or-Promise,
|
|
262
|
-
// ... }
|
|
263
|
-
// To provide multiple level-of-details (LODs) this can be Face to Array
|
|
264
|
-
// of Image or Promise, like this
|
|
265
|
-
// {
|
|
266
|
-
// GL.TEXTURE_CUBE_MAP_POSITIVE_X : [Image-or-Promise-LOD-0, Image-or-Promise-LOD-1],
|
|
267
|
-
// GL.TEXTURE_CUBE_MAP_NEGATIVE_X : [Image-or-Promise-LOD-0, Image-or-Promise-LOD-1],
|
|
268
|
-
// ... }
|
|
269
|
-
|
|
270
|
-
const imageDataMap = this._getImageDataMap(pixels || data);
|
|
271
|
-
|
|
272
|
-
const resolvedFaces = WEBGLTexture.FACES.map(face => {
|
|
273
|
-
const facePixels = imageDataMap[face];
|
|
274
|
-
return Array.isArray(facePixels) ? facePixels : [facePixels];
|
|
275
|
-
});
|
|
276
|
-
this.bind();
|
|
277
|
-
|
|
278
|
-
WEBGLTexture.FACES.forEach((face, index) => {
|
|
279
|
-
if (resolvedFaces[index].length > 1 && this.props.mipmaps !== false) {
|
|
280
|
-
// If the user provides multiple LODs, then automatic mipmap
|
|
281
|
-
// generation generateMipmaps() should be disabled to avoid overwritting them.
|
|
282
|
-
log.warn(`${this.id} has mipmap and multiple LODs.`)();
|
|
283
|
-
}
|
|
284
|
-
resolvedFaces[index].forEach((image, lodLevel) => {
|
|
285
|
-
// TODO: adjust width & height for LOD!
|
|
286
|
-
if (width && height) {
|
|
287
|
-
gl.texImage2D(face, lodLevel, format, width, height, 0 /* border*, format, type, image);
|
|
288
|
-
} else {
|
|
289
|
-
gl.texImage2D(face, lodLevel, format, format, type, image);
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
this.unbind();
|
|
295
|
-
}
|
|
296
|
-
*/
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// luma.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
export function getAttributeLayoutsFromGeometry(geometry: Geometry) {
|
|
7
|
-
const layouts: Record<string, {}> = {};
|
|
8
|
-
let indices = geometry.indices;
|
|
9
|
-
|
|
10
|
-
for (const [name, attribute] of Object.entries(geometry.attributes)) {
|
|
11
|
-
const remappedName = mapAttributeName(name);
|
|
12
|
-
|
|
13
|
-
if (attribute.constant) {
|
|
14
|
-
throw new Error('constant attributes not supported');
|
|
15
|
-
} else {
|
|
16
|
-
const typedArray = attribute.value;
|
|
17
|
-
// Create accessor by copying the attribute and removing `value``
|
|
18
|
-
const accessor = {...attribute};
|
|
19
|
-
delete accessor.value;
|
|
20
|
-
buffers[remappedName] = [device.createBuffer(typedArray), accessor];
|
|
21
|
-
|
|
22
|
-
inferAttributeAccessor(name, accessor);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export class Table {
|
|
28
|
-
length: number;
|
|
29
|
-
// columns: Record<string, TypedArray> = {};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export class GPUTable {
|
|
33
|
-
length: number;
|
|
34
|
-
columns: Record<string, Buffer> = {};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function convertTableToGPUTable(table: Table) {
|
|
38
|
-
// for (const ) {}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function renameTableColumns(table: Table, map: (name: string) => string) {
|
|
42
|
-
const newColumns = table.columns.reduce()
|
|
43
|
-
table.clone();
|
|
44
|
-
}
|
|
45
|
-
*/
|