Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow aggregate component access with .[xyzrgb] #1049
Spatial geometry triples (point, vector, normal) now support A.x, A.y,
Colors now support A.r, A.g, A.b as synonyms for A, A, A,
In both cases, it's for direct reference to lvalues (variables, including
But you can't use this notations on arbitrary expressions:
We are also NOT supporting "swizzling."
Question: Do you specifically care about color vs vector/point/normal type, or will color.x and vector.r also work (not that I particulary care, just curious)
Also, yeah, the spectre of spectral rendering... well.. it's not like every existing shader accessing the individual components wouldn't need to be rewritten anyway for that case (i.e. the problem is component access itself, not the syntax to acheive it), so that's kinda a red herring anyway, isn't it?
Especially since we have no color.numcomponents or similar in OSL (or do we?)
Additional detail: this is 100% forward and back compatible. It's strictly an oslc-side change, so a shader that says "C.r" and is compiled with a new enough oslc to support that syntax can be executed just fine with an older ShadingSystem. Underneath, C.r is just a synonym for C.