#include <ShSwizzle.hpp>
Public Member Functions | |
ShSwizzle (int srcSize) | |
Identity swizzle: does nothing at all. | |
ShSwizzle (int srcSize, int i0) | |
Use one element from the original tuple. | |
ShSwizzle (int srcSize, int i0, int i1) | |
Use two elements from the original tuple. | |
ShSwizzle (int srcSize, int i0, int i1, int i2) | |
Use three elements from the original tuple. | |
ShSwizzle (int srcSize, int i0, int i1, int i2, int i3) | |
Use four elements from the original tuple. | |
ShSwizzle (int srcSize, int size, int *indices) | |
Use an arbitrary number of elements from the original tuple. | |
ShSwizzle (const ShSwizzle &other) | |
ShSwizzle & | operator= (const ShSwizzle &other) |
ShSwizzle & | operator *= (const ShSwizzle &other) |
Combine a swizzle with this one, as if it occured after this swizzle occured. | |
ShSwizzle | operator * (const ShSwizzle &other) const |
Combine two swizzles with left-to-right precedence. | |
int | size () const |
Determine how many elements this swizzle results in. | |
int | operator[] (int i) const |
Obtain the index of the i'th element. | |
bool | identity () const |
Determine whether this is an identity swizzle. | |
bool | operator== (const ShSwizzle &other) const |
Determine whether two swizzles are identical. | |
Friends | |
SH_DLLEXPORT std::ostream & | operator<< (std::ostream &out, const ShSwizzle &swizzle) |
Swizzling takes at least one element from an n-tuple and in essence makes a new n-tuple with those elements in it. To actually perform a swizzle using Sh, you should use the operator() on the variable you are swizzling. This class is internal to Sh.
Swizzles can be combined ("swizzle algebra") using the operator*(). This class currently only supports host-time constant swizzles, ie. you cannot use shader variables to specify swizzling order.
This class is also used for write masks, at least at the intermediate level.
Note that, at the moment, when combining swizzles indices are checked to be sane, but original indices are not checked for sanity, since currently swizzles don't know anything about (in particular the size of) the tuple which they are swizzling.
Definition at line 56 of file ShSwizzle.hpp.
|
Obtain the index of the i'th element. 0 <= i < size(). This is int so that printing out the result won't give something weird Definition at line 186 of file ShSwizzleImpl.hpp. References local, ptr, and SH::shError(). |