通过float*生成vector

This commit is contained in:
2025-10-09 21:31:50 +08:00
parent 83e5f7e040
commit f47fde76c0
3 changed files with 21 additions and 0 deletions
+6
View File
@@ -51,6 +51,12 @@ public:
return *this; return *this;
} }
inline TVector2& operator = (const T* pScalar) {
x = pScalar[0];
y = pScalar[1];
return *this;
}
inline bool operator == (const TVector2& rkVector) const { inline bool operator == (const TVector2& rkVector) const {
return (x == rkVector.x && y == rkVector.y); return (x == rkVector.x && y == rkVector.y);
} }
+7
View File
@@ -62,6 +62,13 @@ public:
return *this; return *this;
} }
inline TVector3& operator = (const T* pScalar) {
x = pScalar[0];
y = pScalar[1];
z = pScalar[2];
return *this;
}
inline bool operator == (const TVector3& rkVector) const { inline bool operator == (const TVector3& rkVector) const {
return (x == rkVector.x && y == rkVector.y && z == rkVector.z); return (x == rkVector.x && y == rkVector.y && z == rkVector.z);
} }
+8
View File
@@ -73,6 +73,14 @@ public:
return *this; return *this;
} }
inline TVector4& operator = (const T* pScalar) {
x = pScalar[0];
y = pScalar[1];
z = pScalar[2];
w = pScalar[4];
return *this;
}
inline bool operator == (const TVector4& rkVector) const { inline bool operator == (const TVector4& rkVector) const {
return (x == rkVector.x && y == rkVector.y && z == rkVector.z && w == rkVector.w); return (x == rkVector.x && y == rkVector.y && z == rkVector.z && w == rkVector.w);
} }