Function setStructuredView

  • Given a set of TypeArrayViews and matching JavaScript data sets the content of the views.

    Example:

    const code = `
    struct Stuff {
    direction: vec3f,
    strength: f32,
    matrix: mat4x4f,
    };
    @group(0) @binding(0) var<uniform> uni: Stuff;
    `;
    const defs = makeShaderDataDefinitions(code);
    const views = makeTypedArrayViews(devs.uniforms.uni.typeDefinition);

    setStructuredViews({
    direction: [1, 2, 3],
    strength: 45,
    matrix: [
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 1, 0,
    0, 0, 0, 1,
    ],
    });

    The code above will set the various views, which all point to different locations within the same array buffer.

    See

    Parameters

    Returns void

    Link

    .

Generated using TypeDoc