MATH: Add stream-reading to the vector-classes

This commit is contained in:
Einar Johan T. Sømåen 2012-01-30 21:04:08 +01:00
parent 6668354920
commit 74047546a0
8 changed files with 63 additions and 9 deletions

View file

@ -21,7 +21,7 @@
*/
#include "common/streamdebug.h"
#include "common/stream.h"
#include "math/vector3d.h"
namespace Math {
@ -55,5 +55,13 @@ void Vector3d::set(float lx, float ly, float lz) {
Angle Vector3d::unitCircleAngle() const {
return Angle::arcTangent2(y(), x());
}
void Vector3d::readFromStream(Common::ReadStream *stream) {
char buf[12];
stream->read(buf, 12);
x() = get_float(buf);
y() = get_float(buf + 4);
z() = get_float(buf + 8);
}
} // end of namespace Math