Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AttributeLocation and remove Command.locate() #36

Open
yanchith opened this issue Sep 8, 2018 · 0 comments
Open

Add AttributeLocation and remove Command.locate() #36

yanchith opened this issue Sep 8, 2018 · 0 comments

Comments

@yanchith
Copy link
Owner

yanchith commented Sep 8, 2018

Allow caching queried attribute locations with AttributeLocation:

const cmd = ...;
const aPosition = dev.queryAttributeLocation(cmd, "a_position");
const aColor = dev.queryAttributeLocation(cmd, "a_color");

// .index property allows for getting the location
const positionLocation = a_position.index;

// toString() allows for use in computed properties
const attrs = dev.createAttributes(Primitive.TRIANGLES, {
  [aPosition]: [
        [-0.3, -0.5],
        [0.3, -0.5],
        [0, 0.5],
    ],
  [aColor]: [
        [1, 0, 0, 1],
        [0, 1, 0, 1],
        [0, 0, 1, 1],
    ],
});

After implementing we can remove Command.locate() and migrate all examples to use this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant