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

Unpacking vector / swizzle notation #209

Closed
bvssvni opened this issue May 22, 2016 · 0 comments
Closed

Unpacking vector / swizzle notation #209

bvssvni opened this issue May 22, 2016 · 0 comments
Assignees
Labels

Comments

@bvssvni
Copy link
Member

bvssvni commented May 22, 2016

Example:

(
    f(1, 0, 0),
    f(0, 1, 0),
    f(0, 0, 1),
    0,
)

Can be written as:

vec4 j {
    v := vec4 i (if i == j { 1 } else { 0 })
    if j == 3 { 0 } else { f(x(v), y(v), z(v)) }
}

Could add a notation for unpacking a vector:

vec4 j (if j == 3 { 0 } else { f(xyz vec4 i (if i == j { 1 } else { 0 }) })

Swizzling

Could use a similar notation for swizzling:

u := (zxy v, 0)

vec2/vec3

Could add vec2 and vec3 for setting last components to 0:

vec3 j f(xyz vec3 i (if i == j { 1 } else { 0 })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant