s, t, p and q are valid swizzle indices?

  • Daodan
  • Topic Author
More
5 years 4 months ago #1 by Daodan s, t, p and q are valid swizzle indices? was created by Daodan
I made a typo and wrote 'variable.t' instead of 'variable.z' (on a qwertz keyboard that is... i'm not that bad of a writer ;) ) and was baffled that this isn't an error as I'm only aware of the '.rgba' and '.xyzw' indices. That made me curious and it seems like '.stp' is the same as '.rgb' and it is also possible to use '.q'. Is there some meaning to this or is it just some leftover from writing the new compiler?

Please Log in or Create an account to join the conversation.

  • Marty McFly
More
5 years 4 months ago #2 by Marty McFly Replied by Marty McFly on topic s, t, p and q are valid swizzle indices?
OpenGL uses these, having them available here makes porting code from OGL easier.
The following user(s) said Thank You: Daodan

Please Log in or Create an account to join the conversation.

  • crosire
More
5 years 4 months ago #3 by crosire Replied by crosire on topic s, t, p and q are valid swizzle indices?
Correct. There are three types of swizzle sets which can be used in different scenarios to make it cleaner what your swizzle accomplishes:
xyzw = geometry vectors
rgba = colors
stpq = texture coordinates

They are just syntactic sugar of course, so you don't have to use them for rhese purposes (it is common that xyzw is used for almost everything).
The following user(s) said Thank You: Daodan

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.