Skip to content

Commit 88a0d3e

Browse files
committed
Deploying to gh-pages from @ 3420af7 🚀
1 parent e7a93e4 commit 88a0d3e

117 files changed

Lines changed: 955 additions & 734 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELIST.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change List
22

3+
### 1.8.0
4+
5+
* Support creating 3d textures from images/canvases...
6+
37
### 1.7.0
48

59
* Add `primitives.deindex`

dist/1.x/attribute-utils.d.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ export type BuffersAndAttributes = {
6262
};
6363
export declare function makeTypedArrayFromArrayUnion(array: ArrayUnion, name: string): TypedArray;
6464
export declare function getNumComponents(array: ArrayUnion, arrayName: string): number;
65-
type TypedArrayWithOffsetAndStride = {
65+
export type TypedArrayWithOffsetAndStride = {
6666
data: TypedArray;
67-
offset: number; /** In elements not bytes */
68-
stride: number; /** In elements not bytes */
67+
offset: number; /** In elements, not bytes */
68+
stride: number; /** In elements, not bytes */
6969
};
7070
/**
7171
* Given a set of named arrays, generates an array `GPUBufferLayout`s
@@ -228,4 +228,3 @@ export declare function setVertexAndIndexBuffers(passEncoder: GPURenderPassEncod
228228
* @param buffersAndAttributes As returned from {@link createBuffersAndAttributesFromArrays}
229229
*/
230230
export declare function drawArrays(passEncoder: GPURenderPassEncoder, buffersAndAttributes: BuffersAndAttributes): void;
231-
export {};

dist/1.x/buffer-views.d.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import { StructDefinition, TypeDefinition, VariableDefinition } from './data-definitions.js';
2-
import { TypedArrayConstructor, TypedArray } from './typed-arrays.js';
3-
type TypeDef = {
4-
numElements: number;
5-
align: number;
6-
size: number;
7-
type: string;
8-
View: TypedArrayConstructor;
9-
flatten?: boolean;
10-
pad?: readonly number[];
11-
};
12-
declare const typeInfo: {
13-
readonly [K: string]: TypeDef;
14-
};
15-
export type kType = Extract<keyof typeof typeInfo, string>;
16-
export declare const kTypes: readonly kType[];
2+
import { TypedArray } from './typed-arrays.js';
3+
import { WGSLType } from './wgsl-types.js';
174
/**
185
* Set which intrinsic types to make views for.
196
*
@@ -27,16 +14,16 @@ export declare const kTypes: readonly kType[];
2714
* what you want.
2815
*
2916
* If you do want individual views then you'd call
30-
* `setIntrinsicsToView(['vec3f`])` and now you get
17+
* `setIntrinsicsToView(['vec3f'])` and now you get
3118
* an array of 200 `Float32Array`s.
3219
*
3320
* Note: `setIntrinsicsToView` always sets ALL types. The list you
3421
* pass it is the types you want views created for, all other types
3522
* will be reset to do the default. In other words
3623
*
3724
* ```js
38-
* setIntrinsicsToView(['vec3f`])
39-
* setIntrinsicsToView(['vec2f`])
25+
* setIntrinsicsToView(['vec3f'])
26+
* setIntrinsicsToView(['vec2f'])
4027
* ```
4128
*
4229
* Only `vec2f` will have views created. `vec3f` has been reset to the default by
@@ -52,7 +39,7 @@ export declare const kTypes: readonly kType[];
5239
* @param types array of types to make views for
5340
* @param flatten whether to flatten or expand the specified types.
5441
*/
55-
export declare function setIntrinsicsToView(types?: readonly kType[], flatten?: boolean): void;
42+
export declare function setIntrinsicsToView(types?: readonly WGSLType[], flatten?: boolean): void;
5643
export type TypedArrayOrViews = TypedArray | Views | Views[];
5744
export interface Views {
5845
[x: string]: TypedArrayOrViews;
@@ -254,4 +241,3 @@ export declare function getSizeAndAlignmentOfUnsizedArrayElement(varDef: Variabl
254241
size: number;
255242
align: number;
256243
};
257-
export {};

dist/1.x/data-definitions.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference types="dist" />
2+
import { WGSLType } from './wgsl-types.js';
23
export type FieldDefinition = {
34
offset: number;
45
type: TypeDefinition;
@@ -13,8 +14,9 @@ export type StructDefinition = TypeDefinition & {
1314
fields: FieldDefinitions;
1415
size: number;
1516
};
17+
export { WGSLType };
1618
export type IntrinsicDefinition = TypeDefinition & {
17-
type: string;
19+
type: WGSLType;
1820
numElements?: number;
1921
};
2022
export type ArrayDefinition = TypeDefinition & {

dist/1.x/primitives.d.ts

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,7 @@ export declare function createPlaneVertices({ width, depth, subdivisionsWidth, s
6262
depth?: number | undefined;
6363
subdivisionsWidth?: number | undefined;
6464
subdivisionsDepth?: number | undefined;
65-
}): {
66-
position: Float32Array;
67-
normal: Float32Array;
68-
texcoord: Float32Array;
69-
indices: Uint16Array;
70-
};
65+
}): Arrays;
7166
/**
7267
* Creates sphere vertices.
7368
*
@@ -95,12 +90,7 @@ export declare function createSphereVertices({ radius, subdivisionsAxis, subdivi
9590
endLatitudeInRadians?: number | undefined;
9691
startLongitudeInRadians?: number | undefined;
9792
endLongitudeInRadians?: number | undefined;
98-
}): {
99-
position: Float32Array;
100-
normal: Float32Array;
101-
texcoord: Float32Array;
102-
indices: Uint16Array;
103-
};
93+
}): Arrays;
10494
/**
10595
* Creates the vertices and indices for a cube.
10696
*
@@ -112,12 +102,7 @@ export declare function createSphereVertices({ radius, subdivisionsAxis, subdivi
112102
*/
113103
export declare function createCubeVertices({ size }?: {
114104
size?: number | undefined;
115-
}): {
116-
position: Float32Array;
117-
normal: Float32Array;
118-
texcoord: Float32Array;
119-
indices: Uint16Array;
120-
};
105+
}): Arrays;
121106
/**
122107
* Creates vertices for a truncated cone, which is like a cylinder
123108
* except that it has different top and bottom radii. A truncated cone
@@ -144,22 +129,15 @@ export declare function createTruncatedConeVertices({ bottomRadius, topRadius, h
144129
verticalSubdivisions?: number | undefined;
145130
topCap?: boolean | undefined;
146131
bottomCap?: boolean | undefined;
147-
}): {
148-
position: Float32Array;
149-
normal: Float32Array;
150-
texcoord: Float32Array;
151-
indices: Uint16Array;
152-
};
132+
}): Arrays;
153133
/**
154134
* Creates 3D 'F' vertices.
155135
* An 'F' is useful because you can easily tell which way it is oriented.
156136
* The created 'F' has position, normal, texcoord, and color arrays.
157137
*
158138
* @return The created vertices.
159139
*/
160-
export declare function create3DFVertices(): {
161-
[k: string]: Uint8Array | Uint16Array | Float32Array;
162-
};
140+
export declare function create3DFVertices(): Arrays;
163141
/**
164142
* Creates cylinder vertices. The cylinder will be created around the origin
165143
* along the y-axis.
@@ -180,12 +158,7 @@ export declare function createCylinderVertices({ radius, height, radialSubdivisi
180158
verticalSubdivisions?: number | undefined;
181159
topCap?: boolean | undefined;
182160
bottomCap?: boolean | undefined;
183-
}): {
184-
position: Float32Array;
185-
normal: Float32Array;
186-
texcoord: Float32Array;
187-
indices: Uint16Array;
188-
};
161+
}): Arrays;
189162
/**
190163
* Creates vertices for a torus
191164
*
@@ -205,12 +178,7 @@ export declare function createTorusVertices({ radius, thickness, radialSubdivisi
205178
bodySubdivisions?: number | undefined;
206179
startAngle?: number | undefined;
207180
endAngle?: number | undefined;
208-
}): {
209-
position: Float32Array;
210-
normal: Float32Array;
211-
texcoord: Float32Array;
212-
indices: Uint16Array;
213-
};
181+
}): Arrays;
214182
/**
215183
* Creates disc vertices. The disc will be in the xz plane, centered at
216184
* the origin. When creating, at least 3 divisions, or pie
@@ -242,12 +210,7 @@ export declare function createDiscVertices({ radius, divisions, stacks, innerRad
242210
stacks?: number | undefined;
243211
innerRadius?: number | undefined;
244212
stackPower?: number | undefined;
245-
}): {
246-
position: Float32Array;
247-
normal: Float32Array;
248-
texcoord: Float32Array;
249-
indices: Uint16Array;
250-
};
213+
}): Arrays;
251214
/**
252215
* Given indexed vertices creates a new set of vertices un-indexed by expanding the vertices by index.
253216
*/

0 commit comments

Comments
 (0)