From 70aae5b6484c05008ffc8171b4e42310f3257b51 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 3 May 2015 23:08:00 -0700 Subject: [PATCH] * Fix CColor subscript operator * Fix CVector2f derps --- CColor.hpp | 2 +- CVector2f.hpp | 14 +++++++------- CVector3f.hpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CColor.hpp b/CColor.hpp index cec8445..8f4035e 100644 --- a/CColor.hpp +++ b/CColor.hpp @@ -33,7 +33,7 @@ public: a = reader.readFloat(); } - inline float operator[](const int& idx) { return (&r)[idx]; } + inline const float& operator[](const int& idx) { return (&r)[idx]; } union { diff --git a/CVector2f.hpp b/CVector2f.hpp index 2f19581..20257e2 100644 --- a/CVector2f.hpp +++ b/CVector2f.hpp @@ -1,5 +1,5 @@ -#ifndef CVector2f_HPP -#define CVector2f_HPP +#ifndef CVECTOR2f_HPP +#define CVECTOR2f_HPP #include "Global.hpp" #include @@ -17,7 +17,7 @@ public: #if __SSE__ CVector2f(const __m128& mVec128) : mVec128(mVec128) {v[2] = 0.0f; v[3] = 0.0f;} #endif - CVector2f(float xyz) {splat(xyz);} + CVector2f(float xy) {splat(xy);} CVector2f(float x, float y) {v[0] = x; v[1] = y; v[2] = 0; v[3] = 0.0;} CVector2f(Athena::io::IStreamReader& input) { @@ -30,7 +30,7 @@ public: inline bool operator ==(const CVector2f& rhs) const {return (x == rhs.x && y == rhs.y);} inline bool operator !=(const CVector2f& rhs) const - {return !(x == rhs.x && y == rhs.y);} + {return !(*this == rhs);} inline CVector2f operator+(const CVector2f& rhs) const { #if __SSE__ @@ -203,13 +203,13 @@ public: #endif } - inline void splat(float xyz) + inline void splat(float xy) { #if __SSE__ - TVectorUnion splat = {{xyz, xyz, 0.0f, 0.0f}}; + TVectorUnion splat = {{xy, xy, 0.0f, 0.0f}}; mVec128 = splat.mVec128; #else - v[0] = xyz; v[1] = xyz; v[2] = 0.0f; v[3] = 0.0f; + v[0] = xy; v[1] = xy; v[2] = 0.0f; v[3] = 0.0f; #endif } diff --git a/CVector3f.hpp b/CVector3f.hpp index a12fd81..e1d9df7 100644 --- a/CVector3f.hpp +++ b/CVector3f.hpp @@ -36,7 +36,7 @@ public: inline bool operator ==(const CVector3f& rhs) const {return (x == rhs.x && y == rhs.y && z == rhs.z);} inline bool operator !=(const CVector3f& rhs) const - {return !(x == rhs.x && y == rhs.y && z == rhs.z);} + {return !(*this == rhs);} inline CVector3f operator+(const CVector3f& rhs) const { #if __SSE__