aboutsummaryrefslogtreecommitdiff
path: root/dep/g3dlite/source/Vector4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dep/g3dlite/source/Vector4.cpp')
-rw-r--r--dep/g3dlite/source/Vector4.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/dep/g3dlite/source/Vector4.cpp b/dep/g3dlite/source/Vector4.cpp
index b5f23d69950..0b19fa5b803 100644
--- a/dep/g3dlite/source/Vector4.cpp
+++ b/dep/g3dlite/source/Vector4.cpp
@@ -4,7 +4,7 @@
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
@created 2001-07-09
- @edited 2010-07-05
+ @edited 2010-11-05
*/
#include <stdlib.h>
@@ -21,6 +21,12 @@
namespace G3D {
+Vector4& Vector4::operator=(const Any& a) {
+ *this = Vector4(a);
+ return *this;
+}
+
+
Vector4::Vector4(const Any& any) {
any.verifyName("Vector4");
any.verifyType(Any::TABLE, Any::ARRAY);
@@ -40,7 +46,8 @@ Vector4::Vector4(const Any& any) {
}
}
-Vector4::operator Any() const {
+
+Any Vector4::toAny() const {
Any any(Any::ARRAY, "Vector4");
any.append(x, y, z, w);
return any;
@@ -134,7 +141,7 @@ Vector4 Vector4::operator/ (float fScalar) const {
Vector4 kQuot;
if ( fScalar != 0.0 ) {
- float fInvScalar = 1.0f / fScalar;
+ float fInvScalar = 1.0f / fScalar;
kQuot.x = fInvScalar * x;
kQuot.y = fInvScalar * y;
kQuot.z = fInvScalar * z;
@@ -148,13 +155,13 @@ Vector4 Vector4::operator/ (float fScalar) const {
//----------------------------------------------------------------------------
Vector4& Vector4::operator/= (float fScalar) {
if (fScalar != 0.0f) {
- float fInvScalar = 1.0f / fScalar;
+ float fInvScalar = 1.0f / fScalar;
x *= fInvScalar;
y *= fInvScalar;
z *= fInvScalar;
w *= fInvScalar;
} else {
- *this = Vector4::inf();
+ *this = Vector4::inf();
}
return *this;
@@ -511,5 +518,12 @@ Vector4 Vector4::ywww() const { return Vector4 (y, w, w, w); }
Vector4 Vector4::zwww() const { return Vector4 (z, w, w, w); }
Vector4 Vector4::wwww() const { return Vector4 (w, w, w, w); }
+void serialize(const Vector4& v, class BinaryOutput& b) {
+ v.serialize(b);
+}
+
+void deserialize(Vector4& v, class BinaryInput& b) {
+ v.deserialize(b);
+}
}; // namespace