Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPorteries Tristan <republicthunderbolt9@gmail.com>2015-10-31 12:24:38 +0300
committerPorteries Tristan <republicthunderbolt9@gmail.com>2015-10-31 21:45:17 +0300
commitd54e71c8bf1b0ea5651f9b44282f367c5d4e0906 (patch)
tree8bfcfb11a0271ae0ee5f5e0a94525fd5d164c316
parentdf61c50ffae9463eafb30b7a3e23b4fcaaca7dbf (diff)
BGE: Moto: use templates to avoid duplicated code to convert in double or float arrays.
-rw-r--r--intern/moto/include/MT_CmMatrix4x4.h27
-rw-r--r--intern/moto/include/MT_Matrix3x3.h58
-rw-r--r--intern/moto/include/MT_Matrix4x4.h56
-rw-r--r--intern/moto/include/MT_Point2.h4
-rw-r--r--intern/moto/include/MT_Point3.h4
-rw-r--r--intern/moto/include/MT_Quaternion.h4
-rw-r--r--intern/moto/include/MT_Transform.h24
-rw-r--r--intern/moto/include/MT_Tuple2.h22
-rw-r--r--intern/moto/include/MT_Tuple3.h36
-rw-r--r--intern/moto/include/MT_Tuple4.h42
-rw-r--r--intern/moto/include/MT_Vector2.h4
-rw-r--r--intern/moto/include/MT_Vector3.h4
-rw-r--r--intern/moto/include/MT_Vector4.h4
-rw-r--r--intern/moto/intern/MT_CmMatrix4x4.cpp28
-rw-r--r--intern/moto/intern/MT_Transform.cpp24
15 files changed, 116 insertions, 225 deletions
diff --git a/intern/moto/include/MT_CmMatrix4x4.h b/intern/moto/include/MT_CmMatrix4x4.h
index 2b710c66888..962451cf456 100644
--- a/intern/moto/include/MT_CmMatrix4x4.h
+++ b/intern/moto/include/MT_CmMatrix4x4.h
@@ -54,16 +54,17 @@ class MT_CmMatrix4x4
public :
- MT_CmMatrix4x4(
- const float value[4][4]
- );
-
- MT_CmMatrix4x4(
- );
-
+ template <typename T>
+ MT_CmMatrix4x4(const T value[4][4])
+ {
+ for (int i=0;i<4;i++)
+ {
+ for (int j=0;j<4;j++)
+ m_V[i][j] = (double)value[i][j];
+ }
+ }
MT_CmMatrix4x4(
- const double value[16]
);
MT_CmMatrix4x4(
@@ -94,11 +95,11 @@ public :
getPointer(
) const;
- void
- setElem(
- int pos,
- double newvalue
- );
+ template <typename T>
+ void setElem(int pos, T newvalue)
+ {
+ m_Vflat[pos] = (double)newvalue;
+ }
MT_Vector3
GetRight(
diff --git a/intern/moto/include/MT_Matrix3x3.h b/intern/moto/include/MT_Matrix3x3.h
index 17dd5335217..eac629eb40b 100644
--- a/intern/moto/include/MT_Matrix3x3.h
+++ b/intern/moto/include/MT_Matrix3x3.h
@@ -55,8 +55,8 @@
class MT_Matrix3x3 {
public:
MT_Matrix3x3() {}
- MT_Matrix3x3(const float *m) { setValue(m); }
- MT_Matrix3x3(const double *m) { setValue(m); }
+ template <typename T>
+ MT_Matrix3x3(const T *m) { setValue(m); }
MT_Matrix3x3(const MT_Quaternion& q) { setRotation(q); }
MT_Matrix3x3(const MT_Quaternion& q, const MT_Vector3& s) {
@@ -97,28 +97,18 @@ public:
m_el[i][2] = v[2];
}
- void setValue(const float *m) {
+ template <typename T>
+ void setValue(const T *m) {
m_el[0][0] = *m++; m_el[1][0] = *m++; m_el[2][0] = *m++; m++;
m_el[0][1] = *m++; m_el[1][1] = *m++; m_el[2][1] = *m++; m++;
m_el[0][2] = *m++; m_el[1][2] = *m++; m_el[2][2] = *m;
}
- void setValue(const double *m) {
- m_el[0][0] = *m++; m_el[1][0] = *m++; m_el[2][0] = *m++; m++;
- m_el[0][1] = *m++; m_el[1][1] = *m++; m_el[2][1] = *m++; m++;
- m_el[0][2] = *m++; m_el[1][2] = *m++; m_el[2][2] = *m;
- }
-
- void setValue3x3(const float *m) {
- m_el[0][0] = *m++; m_el[1][0] = *m++; m_el[2][0] = *m++;
- m_el[0][1] = *m++; m_el[1][1] = *m++; m_el[2][1] = *m++;
- m_el[0][2] = *m++; m_el[1][2] = *m++; m_el[2][2] = *m;
- }
-
- void setValue3x3(const double *m) {
- m_el[0][0] = *m++; m_el[1][0] = *m++; m_el[2][0] = *m++;
- m_el[0][1] = *m++; m_el[1][1] = *m++; m_el[2][1] = *m++;
- m_el[0][2] = *m++; m_el[1][2] = *m++; m_el[2][2] = *m;
+ template <typename T>
+ void setValue3x3(const T *m) {
+ m_el[0][0] = (MT_Scalar)*m++; m_el[1][0] = (MT_Scalar)*m++; m_el[2][0] = (MT_Scalar)*m++;
+ m_el[0][1] = (MT_Scalar)*m++; m_el[1][1] = (MT_Scalar)*m++; m_el[2][1] = (MT_Scalar)*m++;
+ m_el[0][2] = (MT_Scalar)*m++; m_el[1][2] = (MT_Scalar)*m++; m_el[2][2] = (MT_Scalar)*m;
}
void setValue(MT_Scalar xx, MT_Scalar xy, MT_Scalar xz,
@@ -205,28 +195,18 @@ public:
MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(1.0));
}
- void getValue(float *m) const {
- *m++ = (float) m_el[0][0]; *m++ = (float) m_el[1][0]; *m++ = (float) m_el[2][0]; *m++ = (float) 0.0;
- *m++ = (float) m_el[0][1]; *m++ = (float) m_el[1][1]; *m++ = (float) m_el[2][1]; *m++ = (float) 0.0;
- *m++ = (float) m_el[0][2]; *m++ = (float) m_el[1][2]; *m++ = (float) m_el[2][2]; *m = (float) 0.0;
- }
-
- void getValue(double *m) const {
- *m++ = m_el[0][0]; *m++ = m_el[1][0]; *m++ = m_el[2][0]; *m++ = 0.0;
- *m++ = m_el[0][1]; *m++ = m_el[1][1]; *m++ = m_el[2][1]; *m++ = 0.0;
- *m++ = m_el[0][2]; *m++ = m_el[1][2]; *m++ = m_el[2][2]; *m = 0.0;
- }
-
- void getValue3x3(float *m) const {
- *m++ = (float) m_el[0][0]; *m++ = (float) m_el[1][0]; *m++ = (float) m_el[2][0];
- *m++ = (float) m_el[0][1]; *m++ = (float) m_el[1][1]; *m++ = (float) m_el[2][1];
- *m++ = (float) m_el[0][2]; *m++ = (float) m_el[1][2]; *m++ = (float) m_el[2][2];
+ template <typename T>
+ void getValue(T *m) const {
+ *m++ = (T)m_el[0][0]; *m++ = (T)m_el[1][0]; *m++ = (T)m_el[2][0]; *m++ = (T)0;
+ *m++ = (T)m_el[0][1]; *m++ = (T)m_el[1][1]; *m++ = (T)m_el[2][1]; *m++ = (T)0;
+ *m++ = (T)m_el[0][2]; *m++ = (T)m_el[1][2]; *m++ = (T)m_el[2][2]; *m = (T)0;
}
- void getValue3x3(double *m) const {
- *m++ = m_el[0][0]; *m++ = m_el[1][0]; *m++ = m_el[2][0];
- *m++ = m_el[0][1]; *m++ = m_el[1][1]; *m++ = m_el[2][1];
- *m++ = m_el[0][2]; *m++ = m_el[1][2]; *m++ = m_el[2][2];
+ template <typename T>
+ void getValue3x3(T *m) const {
+ *m++ = (T)m_el[0][0]; *m++ = (T)m_el[1][0]; *m++ = (T)m_el[2][0];
+ *m++ = (T)m_el[0][1]; *m++ = (T)m_el[1][1]; *m++ = (T)m_el[2][1];
+ *m++ = (T)m_el[0][2]; *m++ = (T)m_el[1][2]; *m++ = (T)m_el[2][2];
}
MT_Quaternion getRotation() const;
diff --git a/intern/moto/include/MT_Matrix4x4.h b/intern/moto/include/MT_Matrix4x4.h
index de2ea995401..c9d7b6f4a94 100644
--- a/intern/moto/include/MT_Matrix4x4.h
+++ b/intern/moto/include/MT_Matrix4x4.h
@@ -55,11 +55,8 @@ public:
/**
* Initialize all fields with the values pointed at by m. A
* contigous block of 16 values is read. */
- MT_Matrix4x4(const float *m) { setValue(m); }
- /**
- * Initialize all fields with the values pointed at by m. A
- * contigous block of 16 values is read. */
- MT_Matrix4x4(const double *m) { setValue(m); }
+ template <typename T>
+ MT_Matrix4x4(const T *m) { setValue(m); }
/**
* Initialise with these 16 explicit values.
@@ -101,23 +98,14 @@ public:
/**
* Set the matrix to the values pointer at by m. A contiguous
- * block of 16 values is copied. */
- void setValue(const float *m) {
- m_el[0][0] = *m++; m_el[1][0] = *m++; m_el[2][0] = *m++; m_el[3][0] = *m++;
- m_el[0][1] = *m++; m_el[1][1] = *m++; m_el[2][1] = *m++; m_el[3][1] = *m++;
- m_el[0][2] = *m++; m_el[1][2] = *m++; m_el[2][2] = *m++; m_el[3][2] = *m++;
- m_el[0][3] = *m++; m_el[1][3] = *m++; m_el[2][3] = *m++; m_el[3][3] = *m;
- }
-
- /**
- * Set the matrix to the values pointer at by m. A contiguous
- * block of 16 values is copied.
+ * block of 16 values is copied.
*/
- void setValue(const double *m) {
- m_el[0][0] = *m++; m_el[1][0] = *m++; m_el[2][0] = *m++; m_el[3][0] = *m++;
- m_el[0][1] = *m++; m_el[1][1] = *m++; m_el[2][1] = *m++; m_el[3][1] = *m++;
- m_el[0][2] = *m++; m_el[1][2] = *m++; m_el[2][2] = *m++; m_el[3][2] = *m++;
- m_el[0][3] = *m++; m_el[1][3] = *m++; m_el[2][3] = *m++; m_el[3][3] = *m;
+ template <typename T>
+ void setValue(const T *m) {
+ m_el[0][0] = (MT_Scalar)*m++; m_el[1][0] = (MT_Scalar)*m++; m_el[2][0] = (MT_Scalar)*m++; m_el[3][0] = (MT_Scalar)*m++;
+ m_el[0][1] = (MT_Scalar)*m++; m_el[1][1] = (MT_Scalar)*m++; m_el[2][1] = (MT_Scalar)*m++; m_el[3][1] = (MT_Scalar)*m++;
+ m_el[0][2] = (MT_Scalar)*m++; m_el[1][2] = (MT_Scalar)*m++; m_el[2][2] = (MT_Scalar)*m++; m_el[3][2] = (MT_Scalar)*m++;
+ m_el[0][3] = (MT_Scalar)*m++; m_el[1][3] = (MT_Scalar)*m++; m_el[2][3] = (MT_Scalar)*m++; m_el[3][3] = (MT_Scalar)*m;
}
/**
@@ -166,28 +154,20 @@ public:
/**
* Read the element from row i, column j.
*/
- float getElement(int i, int j) {
- return (float) m_el[i][j];
+ template <typename T>
+ T getElement(int i, int j) {
+ return (T)m_el[i][j];
}
/**
* Copy the contents to a contiguous block of 16 floats.
*/
- void getValue(float *m) const {
- *m++ = (float) m_el[0][0]; *m++ = (float) m_el[1][0]; *m++ = (float) m_el[2][0]; *m++ = (float) m_el[3][0];
- *m++ = (float) m_el[0][1]; *m++ = (float) m_el[1][1]; *m++ = (float) m_el[2][1]; *m++ = (float) m_el[3][1];
- *m++ = (float) m_el[0][2]; *m++ = (float) m_el[1][2]; *m++ = (float) m_el[2][2]; *m++ = (float) m_el[3][2];
- *m++ = (float) m_el[0][3]; *m++ = (float) m_el[1][3]; *m++ = (float) m_el[2][3]; *m = (float) m_el[3][3];
- }
-
- /**
- * Copy the contents to a contiguous block of 16 doubles.
- */
- void getValue(double *m) const {
- *m++ = m_el[0][0]; *m++ = m_el[1][0]; *m++ = m_el[2][0]; *m++ = m_el[3][0];
- *m++ = m_el[0][1]; *m++ = m_el[1][1]; *m++ = m_el[2][1]; *m++ = m_el[3][1];
- *m++ = m_el[0][2]; *m++ = m_el[1][2]; *m++ = m_el[2][2]; *m++ = m_el[3][2];
- *m++ = m_el[0][3]; *m++ = m_el[1][3]; *m++ = m_el[2][3]; *m = m_el[3][3];
+ template <typename T>
+ void getValue(T *m) const {
+ *m++ = (T)m_el[0][0]; *m++ = (T)m_el[1][0]; *m++ = (T)m_el[2][0]; *m++ = (T)m_el[3][0];
+ *m++ = (T)m_el[0][1]; *m++ = (T)m_el[1][1]; *m++ = (T)m_el[2][1]; *m++ = (T)m_el[3][1];
+ *m++ = (T)m_el[0][2]; *m++ = (T)m_el[1][2]; *m++ = (T)m_el[2][2]; *m++ = (T)m_el[3][2];
+ *m++ = (T)m_el[0][3]; *m++ = (T)m_el[1][3]; *m++ = (T)m_el[2][3]; *m = (T)m_el[3][3];
}
/**
diff --git a/intern/moto/include/MT_Point2.h b/intern/moto/include/MT_Point2.h
index 587379b21f4..53eba1ddc09 100644
--- a/intern/moto/include/MT_Point2.h
+++ b/intern/moto/include/MT_Point2.h
@@ -52,8 +52,8 @@
class MT_Point2 : public MT_Vector2 {
public:
MT_Point2() {}
- MT_Point2(const float *v2) : MT_Vector2(v2) {}
- MT_Point2(const double *v2) : MT_Vector2(v2) {}
+ template <typename T>
+ MT_Point2(const T *v2) : MT_Vector2(v2) {}
MT_Point2(MT_Scalar x2, MT_Scalar y2) : MT_Vector2(x2, y2) {}
MT_Point2& operator+=(const MT_Vector2& v);
diff --git a/intern/moto/include/MT_Point3.h b/intern/moto/include/MT_Point3.h
index f19b2e2f324..8b0431c2b98 100644
--- a/intern/moto/include/MT_Point3.h
+++ b/intern/moto/include/MT_Point3.h
@@ -52,8 +52,8 @@
class MT_Point3 : public MT_Vector3 {
public:
MT_Point3() {}
- MT_Point3(const float *v) : MT_Vector3(v) {}
- MT_Point3(const double *v) : MT_Vector3(v) {}
+ template <typename T>
+ MT_Point3(const T *v) : MT_Vector3(v) {}
MT_Point3(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz) : MT_Vector3(xx, yy, zz) {}
MT_Point3& operator+=(const MT_Vector3& v);
diff --git a/intern/moto/include/MT_Quaternion.h b/intern/moto/include/MT_Quaternion.h
index 407d291348b..e48a1a16d01 100644
--- a/intern/moto/include/MT_Quaternion.h
+++ b/intern/moto/include/MT_Quaternion.h
@@ -56,8 +56,8 @@ class MT_Quaternion : public MT_Vector4 {
public:
MT_Quaternion() {}
MT_Quaternion(const MT_Vector4& v) : MT_Vector4(v) {}
- MT_Quaternion(const float v[4]) : MT_Vector4(v) {}
- MT_Quaternion(const double v[4]) : MT_Vector4(v) {}
+ template <typename T>
+ MT_Quaternion(const T v[4]) : MT_Vector4(v) {}
MT_Quaternion(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz, MT_Scalar ww) :
MT_Vector4(xx, yy, zz, ww) {}
MT_Quaternion(const MT_Vector3& axis, MT_Scalar mt_angle) {
diff --git a/intern/moto/include/MT_Transform.h b/intern/moto/include/MT_Transform.h
index 9c23482925c..b59b0615f87 100644
--- a/intern/moto/include/MT_Transform.h
+++ b/intern/moto/include/MT_Transform.h
@@ -60,8 +60,8 @@
class MT_Transform {
public:
MT_Transform() {}
- MT_Transform(const float *m) { setValue(m); }
- MT_Transform(const double *m) { setValue(m); }
+ template <typename T>
+ MT_Transform(const T *m) { setValue(m); }
MT_Transform(const MT_Point3& p, const MT_Quaternion& q)
: m_type(IDENTITY)
{
@@ -111,8 +111,13 @@ public:
const MT_Point3& getOrigin() const { return m_origin; }
MT_Quaternion getRotation() const { return m_basis.getRotation(); }
- void setValue(const float *m);
- void setValue(const double *m);
+ template <typename T>
+ void setValue(const T *m)
+ {
+ m_basis.setValue(m);
+ m_origin.setValue(&m[12]);
+ m_type = AFFINE;
+ }
void setOrigin(const MT_Point3& origin) {
m_origin = origin;
@@ -129,9 +134,14 @@ public:
m_type &= ~SCALING;
m_type |= ROTATION;
}
-
- void getValue(float *m) const;
- void getValue(double *m) const;
+
+ template <typename T>
+ void getValue(T *m) const
+ {
+ m_basis.getValue(m);
+ m_origin.getValue(&m[12]);
+ m[15] = 1.0;
+ }
void setIdentity();
diff --git a/intern/moto/include/MT_Tuple2.h b/intern/moto/include/MT_Tuple2.h
index 465b31a6781..7e931f9d2b9 100644
--- a/intern/moto/include/MT_Tuple2.h
+++ b/intern/moto/include/MT_Tuple2.h
@@ -53,8 +53,8 @@
class MT_Tuple2 {
public:
MT_Tuple2() {}
- MT_Tuple2(const float *vv) { setValue(vv); }
- MT_Tuple2(const double *vv) { setValue(vv); }
+ template <typename T>
+ MT_Tuple2(const T *vv) { setValue(vv); }
MT_Tuple2(MT_Scalar xx, MT_Scalar yy) { setValue(xx, yy); }
MT_Scalar& operator[](int i) { return m_co[i]; }
@@ -75,20 +75,14 @@ public:
MT_Scalar *getValue() { return m_co; }
const MT_Scalar *getValue() const { return m_co; }
- void getValue(float *vv) const {
- vv[0] = (float) m_co[0]; vv[1] = (float) m_co[1];
+ template <typename T>
+ void getValue(T *vv) const {
+ vv[0] = (T)m_co[0]; vv[1] = (T)m_co[1];
}
- void getValue(double *vv) const {
- vv[0] = m_co[0]; vv[1] = m_co[1];
- }
-
- void setValue(const float *vv) {
- m_co[0] = vv[0]; m_co[1] = vv[1];
- }
-
- void setValue(const double *vv) {
- m_co[0] = vv[0]; m_co[1] = vv[1];
+ template <typename T>
+ void setValue(const T *vv) {
+ m_co[0] = (MT_Scalar)vv[0]; m_co[1] = (MT_Scalar)vv[1];
}
void setValue(MT_Scalar xx, MT_Scalar yy) {
diff --git a/intern/moto/include/MT_Tuple3.h b/intern/moto/include/MT_Tuple3.h
index ddd8ed724ca..df486029239 100644
--- a/intern/moto/include/MT_Tuple3.h
+++ b/intern/moto/include/MT_Tuple3.h
@@ -53,8 +53,8 @@
class MT_Tuple3 {
public:
MT_Tuple3() {}
- MT_Tuple3(const float *v) { setValue(v); }
- MT_Tuple3(const double *v) { setValue(v); }
+ template <typename T>
+ MT_Tuple3(const T *v) { setValue(v); }
MT_Tuple3(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz) { setValue(xx, yy, zz); }
MT_Scalar& operator[](int i) { return m_co[i]; }
@@ -72,28 +72,18 @@ public:
MT_Scalar *getValue() { return m_co; }
const MT_Scalar *getValue() const { return m_co; }
- void getValue(float *v) const {
- v[0] = float(m_co[0]);
- v[1] = float(m_co[1]);
- v[2] = float(m_co[2]);
+ template <typename T>
+ void getValue(T *v) const {
+ v[0] = (T)m_co[0];
+ v[1] = (T)m_co[1];
+ v[2] = (T)m_co[2];
}
-
- void getValue(double *v) const {
- v[0] = double(m_co[0]);
- v[1] = double(m_co[1]);
- v[2] = double(m_co[2]);
- }
-
- void setValue(const float *v) {
- m_co[0] = MT_Scalar(v[0]);
- m_co[1] = MT_Scalar(v[1]);
- m_co[2] = MT_Scalar(v[2]);
- }
-
- void setValue(const double *v) {
- m_co[0] = MT_Scalar(v[0]);
- m_co[1] = MT_Scalar(v[1]);
- m_co[2] = MT_Scalar(v[2]);
+
+ template <typename T>
+ void setValue(const T *v) {
+ m_co[0] = (MT_Scalar)v[0];
+ m_co[1] = (MT_Scalar)v[1];
+ m_co[2] = (MT_Scalar)v[2];
}
void setValue(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz) {
diff --git a/intern/moto/include/MT_Tuple4.h b/intern/moto/include/MT_Tuple4.h
index aa3b60f1c9b..34564ca8359 100644
--- a/intern/moto/include/MT_Tuple4.h
+++ b/intern/moto/include/MT_Tuple4.h
@@ -53,8 +53,8 @@
class MT_Tuple4 {
public:
MT_Tuple4() {}
- MT_Tuple4(const float *v) { setValue(v); }
- MT_Tuple4(const double *v) { setValue(v); }
+ template <typename T>
+ MT_Tuple4(const T *v) { setValue(v); }
MT_Tuple4(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz, MT_Scalar ww) {
setValue(xx, yy, zz, ww);
}
@@ -78,32 +78,20 @@ public:
const MT_Scalar *getValue() const { return m_co; }
- void getValue(float *v) const {
- v[0] = float(m_co[0]);
- v[1] = float(m_co[1]);
- v[2] = float(m_co[2]);
- v[3] = float(m_co[3]);
+ template <typename T>
+ void getValue(T *v) const {
+ v[0] = (T)m_co[0];
+ v[1] = (T)m_co[1];
+ v[2] = (T)m_co[2];
+ v[3] = (T)m_co[3];
}
-
- void getValue(double *v) const {
- v[0] = double(m_co[0]);
- v[1] = double(m_co[1]);
- v[2] = double(m_co[2]);
- v[3] = double(m_co[3]);
- }
-
- void setValue(const float *v) {
- m_co[0] = MT_Scalar(v[0]);
- m_co[1] = MT_Scalar(v[1]);
- m_co[2] = MT_Scalar(v[2]);
- m_co[3] = MT_Scalar(v[3]);
- }
-
- void setValue(const double *v) {
- m_co[0] = MT_Scalar(v[0]);
- m_co[1] = MT_Scalar(v[1]);
- m_co[2] = MT_Scalar(v[2]);
- m_co[3] = MT_Scalar(v[3]);
+
+ template <typename T>
+ void setValue(const T *v) {
+ m_co[0] = (MT_Scalar)v[0];
+ m_co[1] = (MT_Scalar)v[1];
+ m_co[2] = (MT_Scalar)v[2];
+ m_co[3] = (MT_Scalar)v[3];
}
void setValue(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz, MT_Scalar ww) {
diff --git a/intern/moto/include/MT_Vector2.h b/intern/moto/include/MT_Vector2.h
index 8b8f2478ce3..4a8eee793ac 100644
--- a/intern/moto/include/MT_Vector2.h
+++ b/intern/moto/include/MT_Vector2.h
@@ -53,8 +53,8 @@
class MT_Vector2 : public MT_Tuple2 {
public:
MT_Vector2() {}
- MT_Vector2(const float *v2) : MT_Tuple2(v2) {}
- MT_Vector2(const double *v2) : MT_Tuple2(v2) {}
+ template <typename T>
+ MT_Vector2(const T *v2) : MT_Tuple2(v2) {}
MT_Vector2(MT_Scalar xx, MT_Scalar yy) : MT_Tuple2(xx, yy) {}
MT_Vector2& operator+=(const MT_Vector2& v);
diff --git a/intern/moto/include/MT_Vector3.h b/intern/moto/include/MT_Vector3.h
index b06f345bdaf..c617d1a4006 100644
--- a/intern/moto/include/MT_Vector3.h
+++ b/intern/moto/include/MT_Vector3.h
@@ -54,8 +54,8 @@ class MT_Vector3 : public MT_Tuple3 {
public:
virtual ~MT_Vector3() {}
MT_Vector3() {}
- MT_Vector3(const float *v) : MT_Tuple3(v) {}
- MT_Vector3(const double *v) : MT_Tuple3(v) {}
+ template <typename T>
+ MT_Vector3(const T *v) : MT_Tuple3(v) {}
MT_Vector3(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz) : MT_Tuple3(xx, yy, zz) {}
MT_Vector3& operator+=(const MT_Vector3& v);
diff --git a/intern/moto/include/MT_Vector4.h b/intern/moto/include/MT_Vector4.h
index d157cefa946..0eecc6b5e12 100644
--- a/intern/moto/include/MT_Vector4.h
+++ b/intern/moto/include/MT_Vector4.h
@@ -55,8 +55,8 @@ class MT_Vector4 : public MT_Tuple4 {
public:
virtual ~MT_Vector4() {}
MT_Vector4() {}
- MT_Vector4(const float *v) : MT_Tuple4(v) {}
- MT_Vector4(const double *v) : MT_Tuple4(v) {}
+ template <typename T>
+ MT_Vector4(const T *v) : MT_Tuple4(v) {}
MT_Vector4(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz, MT_Scalar ww) :
MT_Tuple4(xx, yy, zz, ww) {}
diff --git a/intern/moto/intern/MT_CmMatrix4x4.cpp b/intern/moto/intern/MT_CmMatrix4x4.cpp
index 7a04864e48d..4c6c40ac081 100644
--- a/intern/moto/intern/MT_CmMatrix4x4.cpp
+++ b/intern/moto/intern/MT_CmMatrix4x4.cpp
@@ -40,27 +40,6 @@ MT_CmMatrix4x4::MT_CmMatrix4x4()
Identity();
}
-
-
-MT_CmMatrix4x4::MT_CmMatrix4x4(const float value[4][4])
-{
- for (int i=0;i<4;i++)
- {
- for (int j=0;j<4;j++)
- m_V[i][j] = value[i][j];
- }
-}
-
-
-
-MT_CmMatrix4x4::MT_CmMatrix4x4(const double value[16])
-{
- for (int i=0;i<16;i++)
- m_Vflat[i] = value[i];
-}
-
-
-
MT_CmMatrix4x4::MT_CmMatrix4x4(const MT_CmMatrix4x4& other)
{
SetMatrix(other);
@@ -160,13 +139,6 @@ const double* MT_CmMatrix4x4::getPointer() const
return &m_V[0][0];
}
-
-
-void MT_CmMatrix4x4::setElem(int pos,double newvalue)
-{
- m_Vflat[pos] = newvalue;
-}
-
MT_CmMatrix4x4 MT_CmMatrix4x4::Perspective(
MT_Scalar inLeft,
MT_Scalar inRight,
diff --git a/intern/moto/intern/MT_Transform.cpp b/intern/moto/intern/MT_Transform.cpp
index 13dd31b7667..94d01a93bff 100644
--- a/intern/moto/intern/MT_Transform.cpp
+++ b/intern/moto/intern/MT_Transform.cpp
@@ -53,30 +53,6 @@
#include "MT_Transform.h"
-void MT_Transform::setValue(const float *m) {
- m_basis.setValue(m);
- m_origin.setValue(&m[12]);
- m_type = AFFINE;
-}
-
-void MT_Transform::setValue(const double *m) {
- m_basis.setValue(m);
- m_origin.setValue(&m[12]);
- m_type = AFFINE;
-}
-
-void MT_Transform::getValue(float *m) const {
- m_basis.getValue(m);
- m_origin.getValue(&m[12]);
- m[15] = 1.0;
-}
-
-void MT_Transform::getValue(double *m) const {
- m_basis.getValue(m);
- m_origin.getValue(&m[12]);
- m[15] = 1.0;
-}
-
MT_Transform& MT_Transform::operator*=(const MT_Transform& t) {
m_origin += m_basis * t.m_origin;
m_basis *= t.m_basis;