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/vector4d.h"
namespace Math {
@ -50,5 +50,14 @@ Vector4d::Matrix(const float *data) :
void Vector4d::set(float lx, float ly, float lz, float lw) {
x() = lx; y() = ly; z() = lz; w() = lw;
}
void Vector4d::readFromStream(Common::ReadStream *stream) {
char buf[16];
stream->read(buf, 16);
x() = get_float(buf);
y() = get_float(buf + 4);
z() = get_float(buf + 8);
w() = get_float(buf + 12);
}
} // end of namespace Math