X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fvector.h;h=3c2b89880d88b546eedfbab7931dcb0bfdf0284a;hp=d1693af101ab04c5806038b247264302704e5295;hb=f14435e58bfa0fa697a06ba9a454bb30cd37d9d8;hpb=41339bc44d076569c680b2c24c75b30ef1254c1b diff --git a/source/vector.h b/source/vector.h index d1693af1..3c2b8988 100644 --- a/source/vector.h +++ b/source/vector.h @@ -1,22 +1,18 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2009 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef MSP_GL_VECTOR_H_ #define MSP_GL_VECTOR_H_ namespace Msp { namespace GL { +struct Vector4; + struct Vector3 { float x, y, z; Vector3(): x(0), y(0), z(0) { } Vector3(float x_, float y_, float z_): x(x_), y(y_), z(z_) { } + Vector3(const Vector4 &); }; struct Vector4 @@ -29,6 +25,10 @@ struct Vector4 Vector4(const Vector3 &v): x(v.x), y(v.y), z(v.z), w(1) { } }; +inline Vector3::Vector3(const Vector4 &v): + x(v.x/v.w), y(v.y/v.w), z(v.z/v.w) +{ } + } // namespace GL } // namespace Msp