Trenki
Member
You can't do swizzling, that is selecting arbitrary components from a vector and form a new one with them with the vector math library. Something like this would certainly be implementable most likely with the help of macros. Otherwise you simply have to select the appropriate components yourself and form a new vector.
But for performance reasons I strongly advice you not to keep the use of the vector math library withing the fragment shaders to a minimum and also avoid the SDL_MapRGB and other potentially costly functions.
If possible you should directly work with 16bit R5G5A1B5 or R5G6B5 color values and write some helper functions that directly work in this representation.
Still, there might be places where the vector math library is useful within the fragment shader, for instance when you interpolate the normal vector and want to normalize it. This is just an example, actually interpolating and normalizing the normal vector would certainly be too expensive for larger models on the GP2X
But for performance reasons I strongly advice you not to keep the use of the vector math library withing the fragment shaders to a minimum and also avoid the SDL_MapRGB and other potentially costly functions.
If possible you should directly work with 16bit R5G5A1B5 or R5G6B5 color values and write some helper functions that directly work in this representation.
Still, there might be places where the vector math library is useful within the fragment shader, for instance when you interpolate the normal vector and want to normalize it. This is just an example, actually interpolating and normalizing the normal vector would certainly be too expensive for larger models on the GP2X