Skip to content

Commit

Permalink
more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Oct 1, 2024
1 parent e6a8980 commit 063ea88
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/buffer-views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ export type StructuredView = ArrayBufferViews & {
* });
* ```
*
* data definition can come from `
* data definition can come from `defs.uniforms.<nameOfUniform>`, `defs.storages.<nameOfStorage>`
* and `defs.structs.<nameOfStruct>`.
*
* What this function does:
*
Expand Down Expand Up @@ -479,6 +480,21 @@ export type StructuredView = ArrayBufferViews & {
* result.views.worldViewPosition.set([12, 34, 56]);
* result.views.mode[0] = 8;
* ```
*
* Further, `set` is just a short cut for `setStructuredView` passing in the root
* `result'views`.
*
* So, for example, if you want to set the light at index 2, this would work.
*
* ```js
* setStructuredView({
* lightWorldPosition: [1, 2, 3],
* shininess: 4,
* lightDirection: [5, 6, 7],
* innerLimit: 8,
* outerLimit: 9,
* }, result.views.lights[2]);
* ```
*/
export function makeStructuredView(varDef: VariableDefinition | StructDefinition, arrayBuffer?: ArrayBuffer, offset = 0): StructuredView {
const asVarDef = varDef as VariableDefinition;
Expand Down
Empty file removed src/test.ts
Empty file.

0 comments on commit 063ea88

Please sign in to comment.