Pica/Math: Improved the design of the Vec2/Vec3/Vec4 classes and simplified rasterizer code accordingly.

- Swizzlers now return const objects so that things like "first_vec4.xyz() = some_vec3" now will fail to compile (ideally we should support some vector holding references to make this actually work).
- The methods "InsertBeforeX/Y/Z" and "Append" have been replaced by more versions of MakeVec, which now also supports building new vectors from vectors.
- Vector library now follows C++ type promotion rules (hence, the result of Vec2<u8> with another Vec2<u8> is now a Vec2<int>).
This commit is contained in:
Tony Wasserka 2014-08-12 20:04:28 +02:00
parent 62c36a4ef0
commit 162d641a30
3 changed files with 133 additions and 98 deletions

View file

@ -27,7 +27,6 @@ struct OutputVertex {
Math::Vec4<float24> dummy; // quaternions (not implemented, yet)
Math::Vec4<float24> color;
Math::Vec2<float24> tc0;
float24 tc0_v;
// Padding for optimal alignment
float24 pad[14];
@ -36,6 +35,7 @@ struct OutputVertex {
// position after perspective divide
Math::Vec3<float24> screenpos;
float24 pad2;
// Linear interpolation
// factor: 0=this, 1=vtx
@ -59,6 +59,7 @@ struct OutputVertex {
}
};
static_assert(std::is_pod<OutputVertex>::value, "Structure is not POD");
static_assert(sizeof(OutputVertex) == 32 * sizeof(float), "OutputVertex has invalid size");
union Instruction {
enum class OpCode : u32 {