diff --git a/src/nvtt/CompressorDXT1.cpp b/src/nvtt/CompressorDXT1.cpp index 1faad8c..cb68a52 100644 --- a/src/nvtt/CompressorDXT1.cpp +++ b/src/nvtt/CompressorDXT1.cpp @@ -5,6 +5,7 @@ #include "nvmath/nvmath.h" #include // memset +#include // INT_MAX #include // FLT_MAX @@ -55,6 +56,26 @@ namespace nv { float x, y, z; };*/ + inline Vector3::Vector3() {} + inline Vector3::Vector3(float f) : x(f), y(f), z(f) {} + inline Vector3::Vector3(float x, float y, float z) : x(x), y(y), z(z) {} + inline Vector3::Vector3(Vector3::Arg v) : x(v.x), y(v.y), z(v.z) {} + + inline const Vector3 & Vector3::operator=(Vector3::Arg v) + { + x = v.x; + y = v.y; + z = v.z; + return *this; + } + + inline void Vector3::operator+=(Vector3::Arg v) + { + x += v.x; + y += v.y; + z += v.z; + } + inline Vector3 operator*(Vector3 v, float s) { return { v.x * s, v.y * s, v.z * s }; } @@ -107,6 +128,13 @@ namespace nv { this->x = x; this->y = y; this->z = z; } + inline Vector4::Vector4(Vector3::Arg v, float w) : x(v.x), y(v.y), z(v.z), w(w) {} + + inline Vector3 Vector4::xyz() const + { + return Vector3(x, y, z); + } + } /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/nvtt/tests/bc1enc.cpp b/src/nvtt/tests/bc1enc.cpp index 912fdb8..5695fd8 100644 --- a/src/nvtt/tests/bc1enc.cpp +++ b/src/nvtt/tests/bc1enc.cpp @@ -46,6 +46,11 @@ typedef unsigned int u32; #define TEST_AMD_CMP 1 +namespace nv +{ + inline Vector3::Vector3(float f) : x(f), y(f), z(f) {} + inline Vector4::Vector4() {} +} static float mse_to_psnr(float mse) { float rms = sqrtf(mse);