somewhat better working registration system for the lua runtime

This commit is contained in:
Hartmut Seichter 2019-01-24 15:52:03 +01:00
parent 6ee3732994
commit baa209ceea
13 changed files with 141 additions and 91 deletions
src/core

View file

@ -57,7 +57,7 @@ struct matrix_ : matrixbase_<T, matrix_<R, C, T>>
return *this;
}
matrix_(std::initializer_list<T> args)
explicit matrix_(std::initializer_list<T> args)
{
typename std::initializer_list<T>::iterator it = args.begin();
for (;it != args.end();it++) data[it-args.begin()] = *it;
@ -235,7 +235,6 @@ auto operator * (const matrix_<R, Ca, T>& A,
//
//
template <typename T> using matrix2x2_ = matrix_<2, 2, T>;
template <typename T> using matrix3x3_ = matrix_<3, 3, T>;
template <typename T> using matrix4x4_ = matrix_<4, 4, T>;

View file

@ -66,12 +66,15 @@ struct vector3_ : matrix_<3,1,T> {
inline const T& x() const { return (*this)[0]; }
inline T& x() { return (*this)[0]; }
inline vector3_& set_x(T val) { (*this)[0] = val; return *this;}
inline const T& y() const { return (*this)[1]; }
inline T& y() { return (*this)[1]; }
inline vector3_& set_y(T val) { (*this)[1] = val; return *this;}
inline const T& z() const { return (*this)[2]; }
inline T& z() { return (*this)[2]; }
inline vector3_& set_z(T val) { (*this)[2] = val; return *this;}
inline auto xy() const { return vector2_( { x(),y() } ); }
inline auto homogenous(T w = 1) const { return matrix_<4,1,T>( { x(),y(),z(),w } ); }

View file

@ -6,11 +6,11 @@
int main(int argc,char **argv) {
pw::vector2_<float> v2_A = { 3.2, 1.2 };
pw::vector2_<float> v2_B = { 3.2, 1.2 };
// pw::vector2_<float> v2_A = { 3.2, 1.2 };
// pw::vector2_<float> v2_B = { 3.2, 1.2 };
auto AB_lerp = pw::vector2f::lerp(v2_A,v2_B,0.5);
// auto AB_lerp = pw::vector2f::lerp(v2_A,v2_B,0.5);