Core/Misc: update g3dlite lib (#2904)

* Core/Misc: update g3dlite lib

* update

Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
This commit is contained in:
Viste
2020-07-30 13:35:45 +03:00
committed by GitHub
parent 91bbbf08eb
commit fcaf91b8b2
183 changed files with 13258 additions and 8022 deletions

View File

@@ -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