hrydgard/ppsspp — pull request #2823 by neobrain (2013-07-18 08:24:55+00:00)
Title: Math3d extensions

Enhances the feature set of the existing utility Vec3 class by:
- supporting arbitrary base types for each component (e.g. Vec3, Vec3)
- supporting two-component and four-component vectors
- supporting vectors acting purely on references, thus being effective on memory usage (although I guess the compiler should've done this before already)

Additionally, this patch
- cleanly abstracts using Vec3 as a color or as an actual position vector.
- fixes some confusing oddities of the Vec3 API.
- might fix bugs caused by incorrect constructor usage (see below for details).

Changes for other people who used the code before:
- The star operator (*) refers to per-component product now (i.e. Vec2(v1.x*v1.x,v2.y*v2.y)) instead of the dot product. This is more consistent with what other APIs are doing (most notably GLSL/HLSL). For the dot product, a new Dot() function has been introduced. Existing code has been fixed to respect this.
- The % operator has been removed because it's not clear what it means. The new Cross() function should be used instead. There was no code using this functionality.
- The Vec3(u32 rgb) constructor has been removed due to its ambiguity. There have been some cases where the wrong constructor has been actually used, so this might even fix a bug. Anyway, instead the new static member functions Vec3::FromRGB and Vec4::FromRGBA should be used instead.
- What used to be Vec3 (i.e. a three-component vector acting on floats) is now Vec3f.