diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-12-13 10:33:35 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-12-13 10:33:35 +0300 |
commit | ef2aecf2db981b5344e0d14e7f074f1742b0b2f7 (patch) | |
tree | d016e95050f10eda7bc44e1bdfa2f7c4fc0fc024 | |
parent | cf8980559fdc2e9731d9229512a554212173ea4f (diff) | |
parent | d9ee88d126ddb59b68d2561694b522a99e4923b6 (diff) |
Merge branch 'master' into GPencil_Editing_Stage3GPencil_Editing_Stage3
39 files changed, 387 insertions, 713 deletions
diff --git a/intern/moto/include/MT_CmMatrix4x4.h b/intern/moto/include/MT_CmMatrix4x4.h index 2b710c66888..53fdd41fb28 100644 --- a/intern/moto/include/MT_CmMatrix4x4.h +++ b/intern/moto/include/MT_CmMatrix4x4.h @@ -55,7 +55,7 @@ class MT_CmMatrix4x4 public : MT_CmMatrix4x4( - const float value[4][4] + const MT_Scalar value[4][4] ); MT_CmMatrix4x4( @@ -63,7 +63,7 @@ public : MT_CmMatrix4x4( - const double value[16] + const MT_Scalar value[16] ); MT_CmMatrix4x4( @@ -85,19 +85,19 @@ public : const MT_CmMatrix4x4 & other ); - double* + MT_Scalar* getPointer( ); const - double* + MT_Scalar* getPointer( ) const; void setElem( int pos, - double newvalue + MT_Scalar newvalue ); MT_Vector3 @@ -121,7 +121,7 @@ public : const MT_Vector3 & v ); - double& + MT_Scalar& operator ( ) (int row,int col) { return m_V[col][row]; } @@ -139,8 +139,8 @@ public : protected: union { - double m_V[4][4]; - double m_Vflat[16]; + MT_Scalar m_V[4][4]; + MT_Scalar m_Vflat[16]; }; }; diff --git a/intern/moto/include/MT_Matrix3x3.h b/intern/moto/include/MT_Matrix3x3.h index 17dd5335217..8832fd56bf4 100644 --- a/intern/moto/include/MT_Matrix3x3.h +++ b/intern/moto/include/MT_Matrix3x3.h @@ -132,14 +132,14 @@ public: void setRotation(const MT_Quaternion& q) { MT_Scalar d = q.length2(); MT_assert(!MT_fuzzyZero2(d)); - MT_Scalar s = MT_Scalar(2.0) / d; + MT_Scalar s = MT_Scalar(2.0f) / d; MT_Scalar xs = q[0] * s, ys = q[1] * s, zs = q[2] * s; MT_Scalar wx = q[3] * xs, wy = q[3] * ys, wz = q[3] * zs; MT_Scalar xx = q[0] * xs, xy = q[0] * ys, xz = q[0] * zs; MT_Scalar yy = q[1] * ys, yz = q[1] * zs, zz = q[2] * zs; - setValue(MT_Scalar(1.0) - (yy + zz), xy - wz , xz + wy, - xy + wz , MT_Scalar(1.0) - (xx + zz), yz - wx, - xz - wy , yz + wx, MT_Scalar(1.0) - (xx + yy)); + setValue(MT_Scalar(1.0f) - (yy + zz), xy - wz , xz + wy, + xy + wz , MT_Scalar(1.0f) - (xx + zz), yz - wx, + xz - wy , yz + wx, MT_Scalar(1.0f) - (xx + yy)); } /** @@ -169,19 +169,19 @@ public: void getEuler(MT_Scalar& yaw, MT_Scalar& pitch, MT_Scalar& roll) const { - if (m_el[2][0] != -1.0 && m_el[2][0] != 1.0) { + if (m_el[2][0] != -1.0f && m_el[2][0] != 1.0f) { pitch = MT_Scalar(-asin(m_el[2][0])); yaw = MT_Scalar(atan2(m_el[2][1] / cos(pitch), m_el[2][2] / cos(pitch))); roll = MT_Scalar(atan2(m_el[1][0] / cos(pitch), m_el[0][0] / cos(pitch))); } else { roll = MT_Scalar(0); - if (m_el[2][0] == -1.0) { - pitch = MT_PI / 2.0; + if (m_el[2][0] == -1.0f) { + pitch = (float)MT_PI / 2.0f; yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2])); } else { - pitch = - MT_PI / 2.0; + pitch = (float)-MT_PI / 2.0f; yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2])); } } @@ -200,15 +200,15 @@ public: } void setIdentity() { - setValue(MT_Scalar(1.0), MT_Scalar(0.0), MT_Scalar(0.0), - MT_Scalar(0.0), MT_Scalar(1.0), MT_Scalar(0.0), - MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(1.0)); + setValue(MT_Scalar(1.0f), MT_Scalar(0.0f), MT_Scalar(0.0f), + MT_Scalar(0.0f), MT_Scalar(1.0f), MT_Scalar(0.0f), + MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(1.0f)); } 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; + *m++ = (float) m_el[0][0]; *m++ = (float) m_el[1][0]; *m++ = (float) m_el[2][0]; *m++ = (float) 0.0f; + *m++ = (float) m_el[0][1]; *m++ = (float) m_el[1][1]; *m++ = (float) m_el[2][1]; *m++ = (float) 0.0f; + *m++ = (float) m_el[0][2]; *m++ = (float) m_el[1][2]; *m++ = (float) m_el[2][2]; *m = (float) 0.0f; } void getValue(double *m) const { diff --git a/intern/moto/include/MT_Matrix3x3.inl b/intern/moto/include/MT_Matrix3x3.inl index c581640ebfe..088c4b098c8 100644 --- a/intern/moto/include/MT_Matrix3x3.inl +++ b/intern/moto/include/MT_Matrix3x3.inl @@ -7,11 +7,11 @@ GEN_INLINE MT_Quaternion MT_Matrix3x3::getRotation() const { MT_Scalar trace = m_el[0][0] + m_el[1][1] + m_el[2][2]; - if (trace > 0.0) + if (trace > 0.0f) { - MT_Scalar s = sqrt(trace + MT_Scalar(1.0)); - result[3] = s * MT_Scalar(0.5); - s = MT_Scalar(0.5) / s; + MT_Scalar s = sqrt(trace + MT_Scalar(1.0f)); + result[3] = s * MT_Scalar(0.5f); + s = MT_Scalar(0.5f) / s; result[0] = (m_el[2][1] - m_el[1][2]) * s; result[1] = (m_el[0][2] - m_el[2][0]) * s; @@ -28,11 +28,11 @@ GEN_INLINE MT_Quaternion MT_Matrix3x3::getRotation() const { int j = next[i]; int k = next[j]; - MT_Scalar s = sqrt(m_el[i][i] - m_el[j][j] - m_el[k][k] + MT_Scalar(1.0)); + MT_Scalar s = sqrt(m_el[i][i] - m_el[j][j] - m_el[k][k] + MT_Scalar(1.0f)); - result[i] = s * MT_Scalar(0.5); + result[i] = s * MT_Scalar(0.5f); - s = MT_Scalar(0.5) / s; + s = MT_Scalar(0.5f) / s; result[3] = (m_el[k][j] - m_el[j][k]) * s; result[j] = (m_el[j][i] + m_el[i][j]) * s; @@ -80,7 +80,7 @@ GEN_INLINE MT_Matrix3x3 MT_Matrix3x3::inverse() const { MT_Vector3 co(cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1, 0, 2, 1)); MT_Scalar det = MT_dot((*this)[0], co); MT_assert(!MT_fuzzyZero2(det)); - MT_Scalar s = MT_Scalar(1.0) / det; + MT_Scalar s = MT_Scalar(1.0f) / det; return MT_Matrix3x3(co[0] * s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1, 2) * s, co[1] * s, cofac(0, 0, 2, 2) * s, cofac(0, 2, 1, 0) * s, diff --git a/intern/moto/include/MT_Matrix4x4.h b/intern/moto/include/MT_Matrix4x4.h index de2ea995401..045cc3b8361 100644 --- a/intern/moto/include/MT_Matrix4x4.h +++ b/intern/moto/include/MT_Matrix4x4.h @@ -86,7 +86,7 @@ public: basis[0][0],basis[0][1],basis[0][2],origin[0], basis[1][0],basis[1][1],basis[1][2],origin[1], basis[2][0],basis[2][1],basis[2][2],origin[2], - MT_Scalar(0),MT_Scalar(0),MT_Scalar(0),MT_Scalar(1) + MT_Scalar(0.0f),MT_Scalar(0.0f),MT_Scalar(0.0f),MT_Scalar(1.0f) ); } @@ -157,10 +157,10 @@ public: * Set this matrix to I. */ void setIdentity() { - setValue(MT_Scalar(1.0), MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(0.0), - MT_Scalar(0.0), MT_Scalar(1.0), MT_Scalar(0.0), MT_Scalar(0.0), - MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(1.0), MT_Scalar(0.0), - MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(1.0)); + setValue(MT_Scalar(1.0f), MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(0.0f), + MT_Scalar(0.0f), MT_Scalar(1.0f), MT_Scalar(0.0f), MT_Scalar(0.0f), + MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(1.0f), MT_Scalar(0.0f), + MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(1.0f)); } /** diff --git a/intern/moto/include/MT_Matrix4x4.inl b/intern/moto/include/MT_Matrix4x4.inl index 074bd6e4b05..fb72af1f9bf 100644 --- a/intern/moto/include/MT_Matrix4x4.inl +++ b/intern/moto/include/MT_Matrix4x4.inl @@ -11,14 +11,14 @@ GEN_INLINE void MT_Matrix4x4::invert() { for (i=1; i < 4; i++) m_el[0][i] /= m_el[0][0]; for (i=1; i < 4; i++) { for (j=i; j < 4; j++) { // do a column of L - MT_Scalar sum = 0.0; + MT_Scalar sum = 0.0f; for (k = 0; k < i; k++) sum += m_el[j][k] * m_el[k][i]; m_el[j][i] -= sum; } if (i == 3) continue; for (j=i+1; j < 4; j++) { // do a row of U - MT_Scalar sum = 0.0; + MT_Scalar sum = 0.0f; for (k = 0; k < i; k++) sum += m_el[i][k]*m_el[k][j]; m_el[i][j] = @@ -27,9 +27,9 @@ GEN_INLINE void MT_Matrix4x4::invert() { } for (i = 0; i < 4; i++ ) // invert L for (j = i; j < 4; j++ ) { - MT_Scalar x = 1.0; + MT_Scalar x = 1.0f; if ( i != j ) { - x = 0.0; + x = 0.0f; for (k = i; k < j; k++ ) x -= m_el[j][k]*m_el[k][i]; } @@ -38,16 +38,16 @@ GEN_INLINE void MT_Matrix4x4::invert() { for (i = 0; i < 4; i++ ) // invert U for (j = i; j < 4; j++ ) { if ( i == j ) continue; - MT_Scalar sum = 0.0; + MT_Scalar sum = 0.0f; for (k = i; k < j; k++ ) - sum += m_el[k][j]*( (i==k) ? 1.0 : m_el[i][k] ); + sum += m_el[k][j]*( (i==k) ? 1.0f : m_el[i][k] ); m_el[i][j] = -sum; } for (i = 0; i < 4; i++ ) // final inversion for (j = 0; j < 4; j++ ) { - MT_Scalar sum = 0.0; + MT_Scalar sum = 0.0f; for (k = ((i>j)?i:j); k < 4; k++ ) - sum += ((j==k)?1.0:m_el[j][k])*m_el[k][i]; + sum += ((j==k)?1.0f:m_el[j][k])*m_el[k][i]; m_el[j][i] = sum; } } diff --git a/intern/moto/include/MT_Quaternion.h b/intern/moto/include/MT_Quaternion.h index 407d291348b..b7703fe57d6 100644 --- a/intern/moto/include/MT_Quaternion.h +++ b/intern/moto/include/MT_Quaternion.h @@ -70,18 +70,18 @@ public: void setRotation(const MT_Vector3& axis, MT_Scalar mt_angle) { MT_Scalar d = axis.length(); MT_assert(!MT_fuzzyZero(d)); - MT_Scalar s = sin(mt_angle * MT_Scalar(0.5)) / d; + MT_Scalar s = sin(mt_angle * MT_Scalar(0.5f)) / d; setValue(axis[0] * s, axis[1] * s, axis[2] * s, - cos(mt_angle * MT_Scalar(0.5))); + cos(mt_angle * MT_Scalar(0.5f))); } void setEuler(MT_Scalar yaw, MT_Scalar pitch, MT_Scalar roll) { - MT_Scalar cosYaw = cos(yaw * MT_Scalar(0.5)); - MT_Scalar sinYaw = sin(yaw * MT_Scalar(0.5)); - MT_Scalar cosPitch = cos(pitch * MT_Scalar(0.5)); - MT_Scalar sinPitch = sin(pitch * MT_Scalar(0.5)); - MT_Scalar cosRoll = cos(roll * MT_Scalar(0.5)); - MT_Scalar sinRoll = sin(roll * MT_Scalar(0.5)); + MT_Scalar cosYaw = cos(yaw * MT_Scalar(0.5f)); + MT_Scalar sinYaw = sin(yaw * MT_Scalar(0.5f)); + MT_Scalar cosPitch = cos(pitch * MT_Scalar(0.5f)); + MT_Scalar sinPitch = sin(pitch * MT_Scalar(0.5f)); + MT_Scalar cosRoll = cos(roll * MT_Scalar(0.5f)); + MT_Scalar sinRoll = sin(roll * MT_Scalar(0.5f)); setValue(cosRoll * sinPitch * cosYaw + sinRoll * cosPitch * sinYaw, cosRoll * cosPitch * sinYaw - sinRoll * sinPitch * cosYaw, sinRoll * cosPitch * cosYaw - cosRoll * sinPitch * sinYaw, diff --git a/intern/moto/include/MT_Quaternion.inl b/intern/moto/include/MT_Quaternion.inl index ec747c453d3..dcd991096ea 100644 --- a/intern/moto/include/MT_Quaternion.inl +++ b/intern/moto/include/MT_Quaternion.inl @@ -29,8 +29,8 @@ GEN_INLINE MT_Quaternion MT_Quaternion::inverse() const { // pg. 124-132 GEN_INLINE MT_Quaternion MT_Quaternion::random() { MT_Scalar x0 = MT_random(); - MT_Scalar r1 = sqrt(MT_Scalar(1.0) - x0), r2 = sqrt(x0); - MT_Scalar t1 = MT_2_PI * MT_random(), t2 = MT_2_PI * MT_random(); + MT_Scalar r1 = sqrt(MT_Scalar(1.0f) - x0), r2 = sqrt(x0); + MT_Scalar t1 = (float)MT_2_PI * MT_random(), t2 = (float)MT_2_PI * MT_random(); MT_Scalar c1 = cos(t1), s1 = sin(t1); MT_Scalar c2 = cos(t2), s2 = sin(t2); return MT_Quaternion(s1 * r1, c1 * r1, s2 * r2, c2 * r2); @@ -63,11 +63,11 @@ GEN_INLINE MT_Quaternion operator*(const MT_Vector3& w, const MT_Quaternion& q) GEN_INLINE MT_Scalar MT_Quaternion::angle(const MT_Quaternion& q) const { MT_Scalar s = sqrt(length2() * q.length2()); - assert(s != MT_Scalar(0.0)); + assert(s != MT_Scalar(0.0f)); s = dot(q) / s; - s = MT_clamp(s, -1.0, 1.0); + s = MT_clamp(s, -1.0f, 1.0f); return acos(s); } @@ -76,21 +76,21 @@ GEN_INLINE MT_Quaternion MT_Quaternion::slerp(const MT_Quaternion& q, const MT_S { MT_Scalar d, s0, s1; MT_Scalar s = dot(q); - bool neg = (s < 0.0); + bool neg = (s < 0.0f); if (neg) s = -s; - if ((1.0 - s) > 0.0001) + if ((1.0f - s) > 0.0001f) { MT_Scalar theta = acos(s); - d = MT_Scalar(1.0) / sin(theta); - s0 = sin((MT_Scalar(1.0) - t) * theta); + d = MT_Scalar(1.0f) / sin(theta); + s0 = sin((MT_Scalar(1.0f) - t) * theta); s1 = sin(t * theta); } else { - d = MT_Scalar(1.0); - s0 = MT_Scalar(1.0) - t; + d = MT_Scalar(1.0f); + s0 = MT_Scalar(1.0f) - t; s1 = t; } if (neg) diff --git a/intern/moto/include/MT_Scalar.h b/intern/moto/include/MT_Scalar.h index 5e516292d77..93bd1a2e3ab 100644 --- a/intern/moto/include/MT_Scalar.h +++ b/intern/moto/include/MT_Scalar.h @@ -52,7 +52,7 @@ #include "MT_random.h" -typedef double MT_Scalar; //this should be float ! +typedef float MT_Scalar; const MT_Scalar MT_DEGS_PER_RAD(57.29577951308232286465); @@ -64,20 +64,20 @@ const MT_Scalar MT_EPSILON2(1.0e-20); const MT_Scalar MT_INFINITY(1.0e50); inline int MT_sign(MT_Scalar x) { - return x < 0.0 ? -1 : x > 0.0 ? 1 : 0; + return x < 0.0f ? -1 : x > 0.0f ? 1 : 0; } inline MT_Scalar MT_abs(MT_Scalar x) { return fabs(x); } -inline bool MT_fuzzyZero(MT_Scalar x) { return MT_abs(x) < MT_EPSILON; } -inline bool MT_fuzzyZero2(MT_Scalar x) { return MT_abs(x) < MT_EPSILON2; } +inline bool MT_fuzzyZero(MT_Scalar x) { return MT_abs(x) < (float)MT_EPSILON; } +inline bool MT_fuzzyZero2(MT_Scalar x) { return MT_abs(x) < (float)MT_EPSILON2; } inline MT_Scalar MT_radians(MT_Scalar x) { - return x * MT_RADS_PER_DEG; + return x * (float)MT_RADS_PER_DEG; } inline MT_Scalar MT_degrees(MT_Scalar x) { - return x * MT_DEGS_PER_RAD; + return x * (float)MT_DEGS_PER_RAD; } inline MT_Scalar MT_random() { diff --git a/intern/moto/include/MT_Vector2.inl b/intern/moto/include/MT_Vector2.inl index 860f9bad830..c975558b770 100644 --- a/intern/moto/include/MT_Vector2.inl +++ b/intern/moto/include/MT_Vector2.inl @@ -17,7 +17,7 @@ GEN_INLINE MT_Vector2& MT_Vector2::operator*=(MT_Scalar s) { GEN_INLINE MT_Vector2& MT_Vector2::operator/=(MT_Scalar s) { MT_assert(!MT_fuzzyZero(s)); - return *this *= 1.0 / s; + return *this *= 1.0f / s; } GEN_INLINE MT_Vector2 operator+(const MT_Vector2& v1, const MT_Vector2& v2) { @@ -40,7 +40,7 @@ GEN_INLINE MT_Vector2 operator*(MT_Scalar s, const MT_Vector2& v) { return v * s GEN_INLINE MT_Vector2 operator/(const MT_Vector2& v, MT_Scalar s) { MT_assert(!MT_fuzzyZero(s)); - return v * (1.0 / s); + return v * (1.0f / s); } GEN_INLINE MT_Scalar MT_Vector2::dot(const MT_Vector2& vv) const { diff --git a/intern/moto/include/MT_Vector3.inl b/intern/moto/include/MT_Vector3.inl index 09c92c6ab54..8a2328fa295 100644 --- a/intern/moto/include/MT_Vector3.inl +++ b/intern/moto/include/MT_Vector3.inl @@ -17,7 +17,7 @@ GEN_INLINE MT_Vector3& MT_Vector3::operator*=(MT_Scalar s) { GEN_INLINE MT_Vector3& MT_Vector3::operator/=(MT_Scalar s) { MT_assert(!MT_fuzzyZero(s)); - return *this *= MT_Scalar(1.0) / s; + return *this *= MT_Scalar(1.0f) / s; } GEN_INLINE MT_Vector3 operator+(const MT_Vector3& v1, const MT_Vector3& v2) { @@ -40,7 +40,7 @@ GEN_INLINE MT_Vector3 operator*(MT_Scalar s, const MT_Vector3& v) { return v * s GEN_INLINE MT_Vector3 operator/(const MT_Vector3& v, MT_Scalar s) { MT_assert(!MT_fuzzyZero(s)); - return v * (MT_Scalar(1.0) / s); + return v * (MT_Scalar(1.0f) / s); } GEN_INLINE MT_Vector3 operator*(const MT_Vector3& v1, const MT_Vector3& v2) { @@ -64,7 +64,7 @@ GEN_INLINE bool MT_Vector3::fuzzyZero() const { GEN_INLINE void MT_Vector3::noiseGate(MT_Scalar threshold) { if (length2() < threshold) { - setValue(MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(0.0)); + setValue(MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(0.0f)); } } @@ -73,7 +73,7 @@ GEN_INLINE MT_Vector3 MT_Vector3::normalized() const { return *this / length(); GEN_INLINE MT_Vector3 MT_Vector3::safe_normalized() const { MT_Scalar len = length(); return MT_fuzzyZero(len) ? - MT_Vector3(MT_Scalar(1.0), MT_Scalar(0.0), MT_Scalar(0.0)) : + MT_Vector3(MT_Scalar(1.0f), MT_Scalar(0.0f), MT_Scalar(0.0f)) : *this / len; } @@ -116,9 +116,9 @@ GEN_INLINE int MT_Vector3::closestAxis() const { } GEN_INLINE MT_Vector3 MT_Vector3::random() { - MT_Scalar z = MT_Scalar(2.0) * MT_random() - MT_Scalar(1.0); - MT_Scalar r = sqrt(MT_Scalar(1.0) - z * z); - MT_Scalar t = MT_2_PI * MT_random(); + MT_Scalar z = MT_Scalar(2.0f) * MT_random() - MT_Scalar(1.0f); + MT_Scalar r = sqrt(MT_Scalar(1.0f) - z * z); + MT_Scalar t = (float)MT_2_PI * MT_random(); return MT_Vector3(r * cos(t), r * sin(t), z); } diff --git a/intern/moto/include/MT_Vector4.inl b/intern/moto/include/MT_Vector4.inl index 9b4126093c1..1196745e4be 100644 --- a/intern/moto/include/MT_Vector4.inl +++ b/intern/moto/include/MT_Vector4.inl @@ -17,7 +17,7 @@ GEN_INLINE MT_Vector4& MT_Vector4::operator*=(MT_Scalar s) { GEN_INLINE MT_Vector4& MT_Vector4::operator/=(MT_Scalar s) { MT_assert(!MT_fuzzyZero(s)); - return *this *= MT_Scalar(1.0) / s; + return *this *= MT_Scalar(1.0f) / s; } GEN_INLINE MT_Vector4 operator+(const MT_Vector4& v1, const MT_Vector4& v2) { @@ -40,7 +40,7 @@ GEN_INLINE MT_Vector4 operator*(MT_Scalar s, const MT_Vector4& v) { return v * s GEN_INLINE MT_Vector4 operator/(const MT_Vector4& v, MT_Scalar s) { MT_assert(!MT_fuzzyZero(s)); - return v * (MT_Scalar(1.0) / s); + return v * (MT_Scalar(1.0f) / s); } GEN_INLINE MT_Scalar MT_Vector4::dot(const MT_Vector4& v) const { diff --git a/intern/moto/intern/MT_CmMatrix4x4.cpp b/intern/moto/intern/MT_CmMatrix4x4.cpp index 7a04864e48d..38c93b92761 100644 --- a/intern/moto/intern/MT_CmMatrix4x4.cpp +++ b/intern/moto/intern/MT_CmMatrix4x4.cpp @@ -42,7 +42,7 @@ MT_CmMatrix4x4::MT_CmMatrix4x4() -MT_CmMatrix4x4::MT_CmMatrix4x4(const float value[4][4]) +MT_CmMatrix4x4::MT_CmMatrix4x4(const MT_Scalar value[4][4]) { for (int i=0;i<4;i++) { @@ -53,7 +53,7 @@ MT_CmMatrix4x4::MT_CmMatrix4x4(const float value[4][4]) -MT_CmMatrix4x4::MT_CmMatrix4x4(const double value[16]) +MT_CmMatrix4x4::MT_CmMatrix4x4(const MT_Scalar value[16]) { for (int i=0;i<16;i++) m_Vflat[i] = value[i]; @@ -148,21 +148,21 @@ void MT_CmMatrix4x4::SetMatrix(const MT_CmMatrix4x4& other) -double* MT_CmMatrix4x4::getPointer() +MT_Scalar* MT_CmMatrix4x4::getPointer() { return &m_V[0][0]; } -const double* MT_CmMatrix4x4::getPointer() const +const MT_Scalar* MT_CmMatrix4x4::getPointer() const { return &m_V[0][0]; } -void MT_CmMatrix4x4::setElem(int pos,double newvalue) +void MT_CmMatrix4x4::setElem(int pos,MT_Scalar newvalue) { m_Vflat[pos] = newvalue; } @@ -179,28 +179,28 @@ MT_CmMatrix4x4 MT_CmMatrix4x4::Perspective( MT_CmMatrix4x4 mat; // Column 0 - mat(0, 0) = -(2.0*inNear) / (inRight-inLeft); - mat(1, 0) = 0; - mat(2, 0) = 0; - mat(3, 0) = 0; + mat(0, 0) = -(2.0f*inNear) / (inRight-inLeft); + mat(1, 0) = 0.0f; + mat(2, 0) = 0.0f; + mat(3, 0) = 0.0f; // Column 1 - mat(0, 1) = 0; - mat(1, 1) = (2.0*inNear) / (inTop-inBottom); - mat(2, 1) = 0; - mat(3, 1) = 0; + mat(0, 1) = 0.0f; + mat(1, 1) = (2.0f*inNear) / (inTop-inBottom); + mat(2, 1) = 0.0f; + mat(3, 1) = 0.0f; // Column 2 mat(0, 2) = (inRight+inLeft) / (inRight-inLeft); mat(1, 2) = (inTop+inBottom) / (inTop-inBottom); mat(2, 2) = -(inFar+inNear) / (inFar-inNear); - mat(3, 2) = -1; + mat(3, 2) = -1.0f; // Column 3 - mat(0, 3) = 0; - mat(1, 3) = 0; - mat(2, 3) = -(2.0*inFar*inNear) / (inFar-inNear); - mat(3, 3) = 0; + mat(0, 3) = 0.0f; + mat(1, 3) = 0.0f; + mat(2, 3) = -(2.0f*inFar*inNear) / (inFar-inNear); + mat(3, 3) = 0.0f; return mat; } diff --git a/intern/moto/intern/MT_Transform.cpp b/intern/moto/intern/MT_Transform.cpp index 13dd31b7667..49a75b78e46 100644 --- a/intern/moto/intern/MT_Transform.cpp +++ b/intern/moto/intern/MT_Transform.cpp @@ -68,7 +68,7 @@ void MT_Transform::setValue(const double *m) { void MT_Transform::getValue(float *m) const { m_basis.getValue(m); m_origin.getValue(&m[12]); - m[15] = 1.0; + m[15] = 1.0f; } void MT_Transform::getValue(double *m) const { @@ -101,7 +101,7 @@ void MT_Transform::scale(MT_Scalar x, MT_Scalar y, MT_Scalar z) { void MT_Transform::setIdentity() { m_basis.setIdentity(); - m_origin.setValue(MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(0.0)); + m_origin.setValue(MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(0.0f)); m_type = IDENTITY; } diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index d32d679e7ed..87e59885415 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -51,6 +51,7 @@ void test_object_materials(struct Main *bmain, struct ID *id); void BKE_material_resize_object(struct Object *ob, const short totcol, bool do_id_user); void BKE_material_init(struct Material *ma); void BKE_material_remap_object(struct Object *ob, const unsigned int *remap); +void BKE_material_remap_object_calc(struct Object *ob_dst, struct Object *ob_src, short *remap_src_to_dst); struct Material *BKE_material_add(struct Main *bmain, const char *name); struct Material *BKE_material_copy(struct Material *ma); struct Material *localize_material(struct Material *ma); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 8614deddc3e..b913e6de433 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -969,6 +969,62 @@ void BKE_material_remap_object(Object *ob, const unsigned int *remap) } } +/** + * Calculate a material remapping from \a ob_src to \a ob_dst. + * + * \param remap_src_to_dst: An array the size of `ob_src->totcol` + * where index values are filled in which map to \a ob_dst materials. + */ +void BKE_material_remap_object_calc( + Object *ob_dst, Object *ob_src, + short *remap_src_to_dst) +{ + if (ob_src->totcol == 0) { + return; + } + + GHash *gh_mat_map = BLI_ghash_ptr_new_ex(__func__, ob_src->totcol); + + for (int i = 0; i < ob_dst->totcol; i++) { + Material *ma_src = give_current_material(ob_dst, i + 1); + BLI_ghash_reinsert(gh_mat_map, ma_src, SET_INT_IN_POINTER(i), NULL, NULL); + } + + /* setup default mapping (when materials don't match) */ + { + int i = 0; + if (ob_dst->totcol >= ob_src->totcol) { + for (; i < ob_src->totcol; i++) { + remap_src_to_dst[i] = i; + } + } + else { + for (; i < ob_dst->totcol; i++) { + remap_src_to_dst[i] = i; + } + for (; i < ob_src->totcol; i++) { + remap_src_to_dst[i] = 0; + } + } + } + + for (int i = 0; i < ob_src->totcol; i++) { + Material *ma_src = give_current_material(ob_src, i + 1); + + if ((i < ob_dst->totcol) && (ma_src == give_current_material(ob_dst, i + 1))) { + /* when objects have exact matching materials - keep existing index */ + } + else { + void **index_src_p = BLI_ghash_lookup_p(gh_mat_map, ma_src); + if (index_src_p) { + remap_src_to_dst[i] = GET_INT_FROM_POINTER(*index_src_p); + } + } + } + + BLI_ghash_free(gh_mat_map, NULL, NULL); +} + /* XXX - this calls many more update calls per object then are needed, could be optimized */ void assign_matarar(struct Object *ob, struct Material ***matar, short totcol) diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index d6eae348d52..358b5b5696f 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -171,7 +171,7 @@ BLI_INLINE EdgeEntry *edgehash_lookup_entry_prev_ex( EdgeEntry **r_e_prev, const unsigned int bucket_index) { BLI_assert(v0 < v1); - for (EdgeEntry *e_prev = NULL, *e = eh->buckets[bucket_index]; e; e = e->next) { + for (EdgeEntry *e_prev = NULL, *e = eh->buckets[bucket_index]; e; e_prev = e, e = e->next) { if (UNLIKELY(v0 == e->v0 && v1 == e->v1)) { *r_e_prev = e_prev; return e; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 818526ab772..5b9af2fa75c 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -75,6 +75,9 @@ #include "mesh_intern.h" /* own include */ +/* detect isolated holes and fill them */ +#define USE_NET_ISLAND_CONNECT + #define KMAXDIST 10 /* max mouse distance from edge before not detecting it */ /* WARNING: knife float precision is fragile: @@ -166,6 +169,11 @@ typedef struct KnifeTool_OpData { MemArena *arena; +#ifdef USE_NET_ISLAND_CONNECT + /* cleared each use */ + MemArena *arena_edgenet; +#endif + GHash *origvertmap; GHash *origedgemap; GHash *kedgefacemap; @@ -2205,330 +2213,6 @@ static int sort_verts_by_dist_cb(void *co_p, const void *cur_a_p, const void *cu else return 0; } -/* The chain so far goes from an instantiated vertex to kfv (some may be reversed). - * If possible, complete the chain to another instantiated vertex and return 1, else return 0. - * The visited hash says which KnifeVert's have already been tried, not including kfv. */ -static bool find_chain_search(KnifeTool_OpData *kcd, KnifeVert *kfv, ListBase *fedges, SmallHash *visited, - ListBase *chain) -{ - Ref *r; - KnifeEdge *kfe; - KnifeVert *kfv_other; - - if (kfv->v) - return true; - - BLI_smallhash_insert(visited, (uintptr_t)kfv, NULL); - /* Try all possible next edges. Could either go through fedges - * (all the KnifeEdges for the face being cut) or could go through - * kve->edges and restrict to cutting face and uninstantiated edges. - * Not clear which is better. Let's do the first. */ - for (r = fedges->first; r; r = r->next) { - kfe = r->ref; - kfv_other = NULL; - if (kfe->v1 == kfv) - kfv_other = kfe->v2; - else if (kfe->v2 == kfv) - kfv_other = kfe->v1; - if (kfv_other && !BLI_smallhash_haskey(visited, (uintptr_t)kfv_other)) { - knife_append_list(kcd, chain, kfe); - if (find_chain_search(kcd, kfv_other, fedges, visited, chain)) - return true; - BLI_remlink(chain, chain->last); - } - } - return false; -} - -static ListBase *find_chain_from_vertex(KnifeTool_OpData *kcd, KnifeEdge *kfe, BMVert *v, ListBase *fedges) -{ - SmallHash visited_, *visited = &visited_; - ListBase *ans; - bool found; - - ans = knife_empty_list(kcd); - knife_append_list(kcd, ans, kfe); - found = false; - BLI_smallhash_init(visited); - if (kfe->v1->v == v) { - BLI_smallhash_insert(visited, (uintptr_t)(kfe->v1), NULL); - found = find_chain_search(kcd, kfe->v2, fedges, visited, ans); - } - else { - BLI_assert(kfe->v2->v == v); - BLI_smallhash_insert(visited, (uintptr_t)(kfe->v2), NULL); - found = find_chain_search(kcd, kfe->v1, fedges, visited, ans); - } - - BLI_smallhash_release(visited); - - if (found) - return ans; - else - return NULL; -} - -/* Find a chain in fedges from one instantiated vertex to another. - * Remove the edges in the chain from fedges and return a separate list of the chain. */ -static ListBase *find_chain(KnifeTool_OpData *kcd, ListBase *fedges) -{ - Ref *r, *ref; - KnifeEdge *kfe; - BMVert *v1, *v2; - ListBase *ans; - - ans = NULL; - - for (r = fedges->first; r; r = r->next) { - kfe = r->ref; - v1 = kfe->v1->v; - v2 = kfe->v2->v; - if (v1 && v2) { - ans = knife_empty_list(kcd); - knife_append_list(kcd, ans, kfe); - break; - } - if (v1) - ans = find_chain_from_vertex(kcd, kfe, v1, fedges); - else if (v2) - ans = find_chain_from_vertex(kcd, kfe, v2, fedges); - if (ans) - break; - } - if (ans) { - BLI_assert(!BLI_listbase_is_empty(ans)); - for (r = ans->first; r; r = r->next) { - ref = find_ref(fedges, r->ref); - BLI_assert(ref != NULL); - BLI_remlink(fedges, ref); - } - } - return ans; -} - -/* The hole so far goes from kfvfirst to kfv (some may be reversed). - * If possible, complete the hole back to kfvfirst and return 1, else return 0. - * The visited hash says which KnifeVert's have already been tried, not including kfv or kfvfirst. */ -static bool find_hole_search(KnifeTool_OpData *kcd, KnifeVert *kfvfirst, KnifeVert *kfv, ListBase *fedges, - SmallHash *visited, ListBase *hole) -{ - Ref *r; - KnifeEdge *kfe, *kfelast; - KnifeVert *kfv_other; - - if (kfv == kfvfirst) - return true; - - BLI_smallhash_insert(visited, (uintptr_t)kfv, NULL); - kfelast = ((Ref *)hole->last)->ref; - for (r = fedges->first; r; r = r->next) { - kfe = r->ref; - if (kfe == kfelast) - continue; - if (kfe->v1->v || kfe->v2->v) - continue; - kfv_other = NULL; - if (kfe->v1 == kfv) - kfv_other = kfe->v2; - else if (kfe->v2 == kfv) - kfv_other = kfe->v1; - if (kfv_other && !BLI_smallhash_haskey(visited, (uintptr_t)kfv_other)) { - knife_append_list(kcd, hole, kfe); - if (find_hole_search(kcd, kfvfirst, kfv_other, fedges, visited, hole)) - return true; - BLI_remlink(hole, hole->last); - } - } - return false; -} - -/* Find a hole (simple cycle with no instantiated vertices). - * Remove the edges in the cycle from fedges and return a separate list of the cycle */ -static ListBase *find_hole(KnifeTool_OpData *kcd, ListBase *fedges) -{ - ListBase *ans; - Ref *r, *ref; - KnifeEdge *kfe; - SmallHash visited_, *visited = &visited_; - bool found; - - ans = NULL; - found = false; - - for (r = fedges->first; r && !found; r = r->next) { - kfe = r->ref; - if (kfe->v1->v || kfe->v2->v || kfe->v1 == kfe->v2) - continue; - - BLI_smallhash_init(visited); - ans = knife_empty_list(kcd); - knife_append_list(kcd, ans, kfe); - - found = find_hole_search(kcd, kfe->v1, kfe->v2, fedges, visited, ans); - - BLI_smallhash_release(visited); - } - - if (found) { - for (r = ans->first; r; r = r->next) { - kfe = r->ref; - ref = find_ref(fedges, r->ref); - if (ref) - BLI_remlink(fedges, ref); - } - return ans; - } - else { - return NULL; - } -} - -/* Try to find "nice" diagonals - short, and far apart from each other. - * If found, return true and make a 'main chain' going across f which uses - * the two diagonals and one part of the hole, and a 'side chain' that - * completes the hole. */ -static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, ListBase **mainchain, - ListBase **sidechain) -{ - float (*fco)[2], (*hco)[2]; - BMVert **fv; - KnifeVert **hv; - KnifeEdge **he; - Ref *r; - KnifeVert *kfv, *kfvother; - KnifeEdge *kfe; - ListBase *chain; - BMVert *v; - BMIter iter; - int nh, nf, i, j, k, m, ax, ay, sep = 0 /* Quite warnings */, bestsep; - int besti[2], bestj[2]; - float dist_sq, dist_best_sq; - - nh = BLI_listbase_count(hole); - nf = f->len; - if (nh < 2 || nf < 3) - return false; - - /* Gather 2d projections of hole and face vertex coordinates. - * Use best-axis projection - not completely accurate, maybe revisit */ - axis_dominant_v3(&ax, &ay, f->no); - hco = BLI_memarena_alloc(kcd->arena, nh * sizeof(float[2])); - fco = BLI_memarena_alloc(kcd->arena, nf * sizeof(float[2])); - hv = BLI_memarena_alloc(kcd->arena, nh * sizeof(KnifeVert *)); - fv = BLI_memarena_alloc(kcd->arena, nf * sizeof(BMVert *)); - he = BLI_memarena_alloc(kcd->arena, nh * sizeof(KnifeEdge *)); - - i = 0; - kfv = NULL; - kfvother = NULL; - for (r = hole->first; r; r = r->next) { - kfe = r->ref; - he[i] = kfe; - if (kfvother == NULL) { - kfv = kfe->v1; - } - else { - kfv = kfvother; - BLI_assert(kfv == kfe->v1 || kfv == kfe->v2); - } - hco[i][0] = kfv->co[ax]; - hco[i][1] = kfv->co[ay]; - hv[i] = kfv; - kfvother = (kfe->v1 == kfv) ? kfe->v2 : kfe->v1; - i++; - } - - j = 0; - BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) { - fco[j][0] = v->co[ax]; - fco[j][1] = v->co[ay]; - fv[j] = v; - j++; - } - - /* For first diagonal (m == 0), want shortest length. - * For second diagonal (m == 1), want max separation of index of hole - * vertex from the hole vertex used in the first diagonal, and from there - * want the one with shortest length not to the same vertex as the first diagonal. */ - for (m = 0; m < 2; m++) { - besti[m] = -1; - bestj[m] = -1; - dist_best_sq = FLT_MAX; - bestsep = 0; - for (i = 0; i < nh; i++) { - if (m == 1) { - if (i == besti[0]) - continue; - sep = (i + nh - besti[0]) % nh; - sep = MIN2(sep, nh - sep); - if (sep < bestsep) - continue; - dist_best_sq = FLT_MAX; - } - for (j = 0; j < nf; j++) { - bool ok; - - if (m == 1 && j == bestj[0]) - continue; - dist_sq = len_squared_v2v2(hco[i], fco[j]); - if (dist_sq > dist_best_sq) - continue; - - ok = true; - for (k = 0; k < nh && ok; k++) { - if (k == i || (k + 1) % nh == i) - continue; - if (isect_seg_seg_v2(hco[i], fco[j], hco[k], hco[(k + 1) % nh])) - ok = false; - } - if (!ok) - continue; - for (k = 0; k < nf && ok; k++) { - if (k == j || (k + 1) % nf == j) - continue; - if (isect_seg_seg_v2(hco[i], fco[j], fco[k], fco[(k + 1) % nf])) - ok = false; - } - if (ok) { - besti[m] = i; - bestj[m] = j; - if (m == 1) - bestsep = sep; - dist_best_sq = dist_sq; - } - } - } - } - - if (besti[0] != -1 && besti[1] != -1) { - BLI_assert(besti[0] != besti[1] && bestj[0] != bestj[1]); - kfe = new_knife_edge(kcd); - kfe->v1 = get_bm_knife_vert(kcd, fv[bestj[0]]); - kfe->v2 = hv[besti[0]]; - chain = knife_empty_list(kcd); - knife_append_list(kcd, chain, kfe); - for (i = besti[0]; i != besti[1]; i = (i + 1) % nh) { - knife_append_list(kcd, chain, he[i]); - } - kfe = new_knife_edge(kcd); - kfe->v1 = hv[besti[1]]; - kfe->v2 = get_bm_knife_vert(kcd, fv[bestj[1]]); - knife_append_list(kcd, chain, kfe); - *mainchain = chain; - - chain = knife_empty_list(kcd); - for (i = besti[1]; i != besti[0]; i = (i + 1) % nh) { - knife_append_list(kcd, chain, he[i]); - } - *sidechain = chain; - - return true; - } - else { - return false; - } -} - static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f) { bool v1_inside, v2_inside; @@ -2572,201 +2256,110 @@ static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f) return false; } -static bool knife_edge_in_face(KnifeEdge *kfe, BMFace *f) -{ - return knife_verts_edge_in_face(kfe->v1, kfe->v2, f); -} - -/* Split face f with KnifeEdges on chain. f remains as one side, the face formed is put in *newface. - * The new face will be on the left side of the chain as viewed from the normal-out side of f. */ -static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *chain, BMFace **r_f_new) +static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfedges) { BMesh *bm = kcd->em->bm; - KnifeEdge *kfe, *kfelast; - BMVert *v1, *v2; - BMLoop *l_v1, *l_v2; - BMFace *f_new; + KnifeEdge *kfe; Ref *ref; - KnifeVert *kfv, *kfvprev; - BMLoop *l_new, *l_iter; + int edge_array_len = BLI_listbase_count(kfedges); + bool ok; int i; - int nco = BLI_listbase_count(chain) - 1; - float (*cos)[3] = BLI_array_alloca(cos, nco); - KnifeVert **kverts = BLI_array_alloca(kverts, nco); - - kfe = ((Ref *)chain->first)->ref; - v1 = kfe->v1->v ? kfe->v1->v : kfe->v2->v; - kfelast = ((Ref *)chain->last)->ref; - v2 = kfelast->v2->v ? kfelast->v2->v : kfelast->v1->v; - BLI_assert(v1 != NULL && v2 != NULL); - kfvprev = kfe->v1->v == v1 ? kfe->v1 : kfe->v2; - for (ref = chain->first, i = 0; i < nco && ref != chain->last; ref = ref->next, i++) { + + BMFace **face_arr; + int face_arr_len; + + BMEdge **edge_array = BLI_array_alloca(edge_array, edge_array_len); + + /* point to knife edges we've created edges in, edge_array aligned */ + KnifeEdge **kfe_array = BLI_array_alloca(kfe_array, edge_array_len); + + i = 0; + for (ref = kfedges->first; ref; ref = ref->next) { + bool is_new_edge = false; kfe = ref->ref; - BLI_assert(kfvprev == kfe->v1 || kfvprev == kfe->v2); - kfv = kfe->v1 == kfvprev ? kfe->v2 : kfe->v1; - copy_v3_v3(cos[i], kfv->co); - kverts[i] = kfv; - kfvprev = kfv; - } - BLI_assert(i == nco); - l_new = NULL; - if ((l_v1 = BM_face_vert_share_loop(f, v1)) && - (l_v2 = BM_face_vert_share_loop(f, v2))) - { - if (nco == 0) { - /* Want to prevent creating two-sided polygons */ - if (v1 == v2 || BM_edge_exists(v1, v2)) { - f_new = NULL; + if (kfe->e == NULL) { + if (kfe->v1->v && kfe->v2->v) { + kfe->e = BM_edge_exists(kfe->v1->v, kfe->v2->v); } - else { - f_new = BM_face_split(bm, f, l_v1, l_v2, &l_new, NULL, true); + } + + if (kfe->e) { + if (BM_edge_in_face(kfe->e, f)) { + /* shouldn't happen, but in this case - just ignore */ + continue; } } else { - f_new = BM_face_split_n(bm, f, l_v1, l_v2, cos, nco, &l_new, NULL); - if (f_new) { - /* Now go through lnew chain matching up chain kv's and assign real v's to them */ - for (l_iter = l_new->next, i = 0; i < nco; l_iter = l_iter->next, i++) { - BLI_assert(equals_v3v3(cos[i], l_iter->v->co)); - if (kcd->select_result) { - BM_edge_select_set(bm, l_iter->e, true); - } - kverts[i]->v = l_iter->v; + if (kfe->v1->v == NULL) { + kfe->v1->v = BM_vert_create(bm, kfe->v1->co, NULL, 0); + } + if (kfe->v2->v == NULL) { + kfe->v2->v = BM_vert_create(bm, kfe->v2->co, NULL, 0); + } + BLI_assert(kfe->e == NULL); + kfe->e = BM_edge_create(bm, kfe->v1->v, kfe->v2->v, NULL, 0); + if (kfe->e) { + if (kcd->select_result || BM_elem_flag_test(f, BM_ELEM_SELECT)) { + BM_edge_select_set(bm, kfe->e, true); } + is_new_edge = true; } } - } - else { - f_new = NULL; - } - /* the select chain above doesnt account for the first loop */ - if (kcd->select_result) { - if (l_new) { - BM_edge_select_set(bm, l_new->e, true); - } - } - else if (f_new) { - BM_elem_select_copy(bm, bm, f_new, f); + BLI_assert(kfe->e); + + kfe_array[i] = is_new_edge ? kfe : 0; + edge_array[i] = kfe->e; + i += 1; } - *r_f_new = f_new; -} + if (i) { + const int edge_array_len_orig = i; + edge_array_len = i; -static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfedges) -{ - BMesh *bm = kcd->em->bm; - KnifeEdge *kfe; - BMFace *fnew, *fnew2, *fhole; - ListBase *chain, *hole, *sidechain; - Ref *ref, *refnext; - int count, oldcount; - - oldcount = BLI_listbase_count(kfedges); - while ((chain = find_chain(kcd, kfedges)) != NULL) { - ListBase fnew_kfedges; - knife_make_chain_cut(kcd, f, chain, &fnew); - if (!fnew) { - return; - } - - /* Move kfedges to fnew_kfedges if they are now in fnew. - * The chain edges were removed already */ - BLI_listbase_clear(&fnew_kfedges); - for (ref = kfedges->first; ref; ref = refnext) { - kfe = ref->ref; - refnext = ref->next; - if (knife_edge_in_face(kfe, fnew)) { - BLI_remlink(kfedges, ref); - kfe->basef = fnew; - BLI_addtail(&fnew_kfedges, ref); - } - else if (!knife_edge_in_face(kfe, f)) { - /* Concave ngon's - this edge might not be in either faces, T41730 */ - BLI_remlink(kfedges, ref); +#ifdef USE_NET_ISLAND_CONNECT + unsigned int edge_array_holes_len; + BMEdge **edge_array_holes; + if (BM_face_split_edgenet_connect_islands( + bm, f, + edge_array, edge_array_len, + kcd->arena_edgenet, + &edge_array_holes, &edge_array_holes_len)) + { + if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { + for (i = edge_array_len; i < edge_array_holes_len; i++) { + BM_edge_select_set(bm, edge_array_holes[i], true); + } } - } - if (fnew_kfedges.first) - knife_make_face_cuts(kcd, fnew, &fnew_kfedges); - /* find_chain should always remove edges if it returns true, - * but guard against infinite loop anyway */ - count = BLI_listbase_count(kfedges); - if (count >= oldcount) { - BLI_assert(!"knife find_chain infinite loop"); - return; + edge_array_len = edge_array_holes_len; + edge_array = edge_array_holes; /* owned by the arena */ } - oldcount = count; - } +#endif - while ((hole = find_hole(kcd, kfedges)) != NULL) { - if (find_hole_chains(kcd, hole, f, &chain, &sidechain)) { - ListBase fnew_kfedges, fnew2_kfedges; + ok = BM_face_split_edgenet( + bm, f, edge_array, edge_array_len, + &face_arr, &face_arr_len); - /* chain goes across f and sidechain comes back - * from the second last vertex to the second vertex. - */ - knife_make_chain_cut(kcd, f, chain, &fnew); - if (!fnew) { - BLI_assert(!"knife failed hole cut"); - return; - } - kfe = ((Ref *)sidechain->first)->ref; - if (knife_edge_in_face(kfe, f)) { - knife_make_chain_cut(kcd, f, sidechain, &fnew2); - if (fnew2 == NULL) { - return; - } - fhole = f; - } - else if (knife_edge_in_face(kfe, fnew)) { - knife_make_chain_cut(kcd, fnew, sidechain, &fnew2); - if (fnew2 == NULL) { - return; - } - fhole = fnew2; - } - else { - /* shouldn't happen except in funny edge cases */ - return; - } - BM_face_kill(bm, fhole); - /* Move kfedges to either fnew or fnew2 if appropriate. - * The hole edges were removed already */ - BLI_listbase_clear(&fnew_kfedges); - BLI_listbase_clear(&fnew2_kfedges); - for (ref = kfedges->first; ref; ref = refnext) { - kfe = ref->ref; - refnext = ref->next; - if (knife_edge_in_face(kfe, fnew)) { - BLI_remlink(kfedges, ref); - kfe->basef = fnew; - BLI_addtail(&fnew_kfedges, ref); - } - else if (knife_edge_in_face(kfe, fnew2)) { - BLI_remlink(kfedges, ref); - kfe->basef = fnew2; - BLI_addtail(&fnew2_kfedges, ref); + if (ok) { + MEM_freeN(face_arr); + } + + /* remove dangling edges, not essential - but nice for users */ + for (i = 0; i < edge_array_len_orig; i++) { + if (kfe_array[i]) { + if (BM_edge_is_wire(kfe_array[i]->e)) { + BM_edge_kill(bm, kfe_array[i]->e); + kfe_array[i]->e = NULL; } } - /* We'll skip knife edges that are in the newly formed hole. - * (Maybe we shouldn't have made a hole in the first place?) */ - if (fnew != fhole && fnew_kfedges.first) - knife_make_face_cuts(kcd, fnew, &fnew_kfedges); - if (fnew2 != fhole && fnew2_kfedges.first) - knife_make_face_cuts(kcd, fnew2, &fnew2_kfedges); - if (f == fhole) - break; - /* find_hole should always remove edges if it returns true, - * but guard against infinite loop anyway */ - count = BLI_listbase_count(kfedges); - if (count >= oldcount) { - BLI_assert(!"knife find_hole infinite loop"); - return; - } - oldcount = count; } + + +#ifdef USE_NET_ISLAND_CONNECT + BLI_memarena_clear(kcd->arena_edgenet); +#endif } } @@ -2915,6 +2508,9 @@ static void knifetool_exit_ex(bContext *C, KnifeTool_OpData *kcd) BLI_ghash_free(kcd->facetrimap, NULL, NULL); BLI_memarena_free(kcd->arena); +#ifdef USE_NET_ISLAND_CONNECT + BLI_memarena_free(kcd->arena_edgenet); +#endif /* tag for redraw */ ED_region_tag_redraw(kcd->ar); @@ -3000,6 +2596,9 @@ static void knifetool_init(bContext *C, KnifeTool_OpData *kcd, knifetool_init_bmbvh(kcd); kcd->arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 15), "knife"); +#ifdef USE_NET_ISLAND_CONNECT + kcd->arena_edgenet = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 15), __func__); +#endif kcd->vthresh = KMAXDIST - 1; kcd->ethresh = KMAXDIST; diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 8eead9b8e44..5f046e3b6c6 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -480,7 +480,7 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa) // XXX for now, this will be a operator button which calls a temporary 'add modifier' operator // FIXME: we need to set the only-active property so that this will only add modifiers for the active strip (not all selected) - uiDefButO(block, UI_BTYPE_BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), 10, 0, 150, 20, + uiDefButO(block, UI_BTYPE_BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), 10, 0, UI_UNIT_X * 7.0f, UI_UNIT_Y, TIP_("Adds a new F-Modifier for the active NLA Strip")); /* copy/paste (as sub-row)*/ diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 57318e44eec..92570263856 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -54,7 +54,9 @@ #include "MOD_util.h" #ifdef USE_BMESH +#include "BLI_alloca.h" #include "BLI_math_geom.h" +#include "BKE_material.h" #include "MEM_guardedalloc.h" #include "bmesh.h" @@ -238,17 +240,30 @@ static DerivedMesh *applyModifier_bmesh( /* we need face normals because of 'BM_face_split_edgenet' * we could calculate on the fly too (before calling split). */ - float nmat[4][4]; - invert_m4_m4(nmat, omat); - - BMFace *efa; - i = 0; - BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { - mul_transposed_mat3_m4_v3(nmat, efa->no); - normalize_v3(efa->no); - BM_elem_flag_enable(efa, BM_FACE_TAG); /* temp tag to test which side split faces are from */ - if (++i == i_faces_end) { - break; + { + float nmat[4][4]; + invert_m4_m4(nmat, omat); + + const short ob_src_totcol = bmd->object->totcol; + short *material_remap = BLI_array_alloca(material_remap, ob_src_totcol ? ob_src_totcol : 1); + + BKE_material_remap_object_calc(ob, bmd->object, material_remap); + + BMFace *efa; + i = 0; + BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { + mul_transposed_mat3_m4_v3(nmat, efa->no); + normalize_v3(efa->no); + BM_elem_flag_enable(efa, BM_FACE_TAG); /* temp tag to test which side split faces are from */ + + /* remap material */ + if (LIKELY(efa->mat_nr < ob_src_totcol)) { + efa->mat_nr = material_remap[efa->mat_nr]; + } + + if (++i == i_faces_end) { + break; + } } } } diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index 420f1f7eb98..13a5ec6c411 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -194,7 +194,10 @@ void KX_FontObject::DrawFontText() /* Get a working copy of the OpenGLMatrix to use */ double mat[16]; - memcpy(mat, this->GetOpenGLMatrix(), sizeof(double)*16); + float *origmat = GetOpenGLMatrix(); + for (unsigned short i = 0; i < 16; ++i) { + mat[i] = (double)origmat[i]; + } /* Account for offset */ MT_Vector3 offset = this->NodeGetWorldOrientation() * m_offset * this->NodeGetWorldScaling(); diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 412a112df6b..38d8a303fe8 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -700,10 +700,10 @@ void KX_GameObject::ApplyRotation(const MT_Vector3& drot,bool local) /** * GetOpenGL Matrix, returns an OpenGL 'compatible' matrix */ -double* KX_GameObject::GetOpenGLMatrix() +float *KX_GameObject::GetOpenGLMatrix() { // todo: optimize and only update if necessary - double* fl = m_OpenGL_4x4Matrix.getPointer(); + float *fl = m_OpenGL_4x4Matrix.getPointer(); if (GetSGNode()) { MT_Transform trans; @@ -742,7 +742,7 @@ void KX_GameObject::AddMeshUser() m_meshes[i]->AddMeshUser(this, &m_meshSlots, GetDeformer()); } // set the part of the mesh slot that never change - double* fl = GetOpenGLMatrixPtr()->getPointer(); + float *fl = GetOpenGLMatrixPtr()->getPointer(); SG_QList::iterator<RAS_MeshSlot> mit(m_meshSlots); // RAS_MeshSlot* ms; @@ -2768,7 +2768,7 @@ PyObject *KX_GameObject::pyattr_get_localTransform(void *self_v, const KX_PYATTR { KX_GameObject* self = static_cast<KX_GameObject*>(self_v); - double mat[16]; + float mat[16]; MT_Transform trans; diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index c2c455dab6a..a25f999026c 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -175,7 +175,7 @@ public: * side effect of storing the result internally. The * memory for the matrix remains the property of this class. */ - double * + float * GetOpenGLMatrix( ); diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 16d1fdd6ea2..350bad0a336 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1557,9 +1557,9 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* rasty,KX_Camera* cam, int planes[5].setValue(cplanes[3].getValue()); // bottom CullingInfo info(layer); - double mvmat[16] = {0}; + float mvmat[16] = {0}; cam->GetModelviewMatrix().getValue(mvmat); - double pmat[16] = {0}; + float pmat[16] = {0}; cam->GetProjectionMatrix().getValue(pmat); dbvt_culling = m_physicsEnvironment->CullingTest(PhysicsCullingCallback,&info,planes,5,m_dbvt_occlusion_res, diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index d7b043661a0..9f0fc6d9d4d 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -1472,7 +1472,7 @@ struct OcclusionBuffer m[15] = btScalar(m1[3] * m2[12] + m1[7] * m2[13] + m1[11] * m2[14] + m1[15] * m2[15]); } - void setup(int size, const int *view, double modelview[16], double projection[16]) + void setup(int size, const int *view, float modelview[16], float projection[16]) { m_initialized = false; m_occlusion = false; @@ -1519,7 +1519,7 @@ struct OcclusionBuffer m_occlusion = false; } - void SetModelMatrix(double *fl) + void SetModelMatrix(float *fl) { CMmat4mul(m_mtc,m_wtc,fl); if (!m_initialized) { @@ -1969,7 +1969,7 @@ struct DbvtCullingCallback : btDbvt::ICollide KX_GameObject* gameobj = KX_GameObject::GetClientObject(info); if (gameobj && gameobj->GetOccluder()) { - double* fl = gameobj->GetOpenGLMatrixPtr()->getPointer(); + float *fl = gameobj->GetOpenGLMatrixPtr()->getPointer(); // this will create the occlusion buffer if not already done // and compute the transformation from model local space to clip space m_ocb->SetModelMatrix(fl); @@ -2010,7 +2010,7 @@ struct DbvtCullingCallback : btDbvt::ICollide }; static OcclusionBuffer gOcb; -bool CcdPhysicsEnvironment::CullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4 *planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) +bool CcdPhysicsEnvironment::CullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4 *planes, int nplanes, int occlusionRes, const int *viewport, float modelview[16], float projection[16]) { if (!m_cullingTree) return false; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index 86f663959f1..a64d2c8f15f 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -211,7 +211,7 @@ protected: btTypedConstraint* GetConstraintById(int constraintId); virtual PHY_IPhysicsController* RayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ); - virtual bool CullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]); + virtual bool CullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, float modelview[16], float projection[16]); //Methods for gamelogic collision/physics callbacks diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h index 929345d7161..3e9379dd60d 100644 --- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h +++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h @@ -83,7 +83,7 @@ public: } virtual PHY_IPhysicsController* RayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ); - virtual bool CullingTest(PHY_CullingCallback callback, void* userData, class MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) { return false; } + virtual bool CullingTest(PHY_CullingCallback callback, void* userData, class MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, float modelview[16], float projection[16]) { return false; } //gamelogic callbacks diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h index 4b8d36285be..2997048805f 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h +++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h @@ -183,7 +183,7 @@ class PHY_IPhysicsEnvironment //culling based on physical broad phase // the plane number must be set as follow: near, far, left, right, top, botton // the near plane must be the first one and must always be present, it is used to get the direction of the view - virtual bool CullingTest(PHY_CullingCallback callback, void *userData, MT_Vector4* planeNormals, int planeNumber, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) = 0; + virtual bool CullingTest(PHY_CullingCallback callback, void *userData, MT_Vector4* planeNormals, int planeNumber, int occlusionRes, const int *viewport, float modelview[16], float projection[16]) = 0; //Methods for gamelogic collision/physics callbacks //todo: diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index cedc27c3b92..82b26749fd1 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -495,10 +495,10 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glBegin(GL_QUADS); glColor4f(1.f, 1.f, 1.f, 1.f); - glTexCoord2f(1.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[3]); glVertex2f(1,1); - glTexCoord2f(0.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[3]); glVertex2f(-1,1); - glTexCoord2f(0.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[2]); glVertex2f(-1,-1); - glTexCoord2f(1.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[2]); glVertex2f(1,-1); + glTexCoord2f(1.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[3]); glVertex2f(1.0f,1.0f); + glTexCoord2f(0.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[3]); glVertex2f(-1.0f,1.0f); + glTexCoord2f(0.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[2]); glVertex2f(-1.0f,-1.0f); + glTexCoord2f(1.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[2]); glVertex2f(1.0f,-1.0f); glEnd(); } } diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp index f90b5959f76..d131891cb90 100644 --- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp +++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp @@ -282,7 +282,7 @@ void RAS_BucketManager::OptimizeBuckets(MT_Scalar distance) { BucketList::iterator bit; - distance = 10.0; + distance = 10.0f; for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) (*bit)->Optimize(distance); diff --git a/source/gameengine/Rasterizer/RAS_CameraData.h b/source/gameengine/Rasterizer/RAS_CameraData.h index e2024a4a55d..bc8433afd05 100644 --- a/source/gameengine/Rasterizer/RAS_CameraData.h +++ b/source/gameengine/Rasterizer/RAS_CameraData.h @@ -51,10 +51,10 @@ struct RAS_CameraData int m_viewporttop; float m_focallength; - RAS_CameraData(float lens = 35.0, float scale = 6.0, float sensor_x = 32.0, float sensor_y = 18.0, short sensor_fit = 0, - float shift_x = 0.0, float shift_y = 0.0, - float clipstart = 0.1, float clipend = 5000.0, bool perspective = true, - float focallength = 3.0, bool viewport = false, int viewportleft = 0, int viewportbottom = 0, + RAS_CameraData(float lens = 35.0f, float scale = 6.0f, float sensor_x = 32.0f, float sensor_y = 18.0f, short sensor_fit = 0, + float shift_x = 0.0f, float shift_y = 0.0f, + float clipstart = 0.1f, float clipend = 5000.0f, bool perspective = true, + float focallength = 3.0f, bool viewport = false, int viewportleft = 0, int viewportbottom = 0, int viewportright = 0, int viewporttop = 0) : m_lens(lens), m_scale(scale), diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp index c5f15c9ad21..8b0ec22fde3 100644 --- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp +++ b/source/gameengine/Rasterizer/RAS_FramingManager.cpp @@ -283,14 +283,14 @@ ComputeFrustum( switch (sensor_fit) { case RAS_SENSORFIT_HOR: { - x_scale = 1.0; + x_scale = 1.0f; y_scale = float(viewport.GetHeight()) / float(viewport.GetWidth()); break; } case RAS_SENSORFIT_VERT: { x_scale = float(viewport.GetWidth()) / float(viewport.GetHeight()); - y_scale = 1.0; + y_scale = 1.0f; break; } case RAS_SENSORFIT_AUTO: @@ -377,14 +377,14 @@ RAS_FramingManager:: switch (sensor_fit) { case RAS_SENSORFIT_HOR: { - x_scale = 1.0; + x_scale = 1.0f; y_scale = float(viewport.GetHeight()) / float(viewport.GetWidth()); break; } case RAS_SENSORFIT_VERT: { x_scale = float(viewport.GetWidth()) / float(viewport.GetHeight()); - y_scale = 1.0; + y_scale = 1.0f; break; } case RAS_SENSORFIT_AUTO: diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp index d07b4910968..2a736aa7deb 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp @@ -62,10 +62,10 @@ void RAS_IPolyMaterial::Initialize( m_polymatid = m_newpolymatid++; m_flag = 0; m_multimode = 0; - m_shininess = 35.0; - m_specular.setValue(0.5,0.5,0.5); - m_specularity = 1.0; - m_diffuse.setValue(0.5,0.5,0.5); + m_shininess = 35.0f; + m_specular.setValue(0.5f,0.5f,0.5f); + m_specularity = 1.0f; + m_diffuse.setValue(0.5f,0.5f,0.5f); m_drawingmode = ConvertFaceMode(game, image); } @@ -85,10 +85,10 @@ RAS_IPolyMaterial::RAS_IPolyMaterial() m_flag(0), m_multimode(0) { - m_shininess = 35.0; - m_specular = MT_Vector3(0.5,0.5,0.5); - m_specularity = 1.0; - m_diffuse = MT_Vector3(0.5,0.5,0.5); + m_shininess = 35.0f; + m_specular = MT_Vector3(0.5f,0.5f,0.5f); + m_specularity = 1.0f; + m_diffuse = MT_Vector3(0.5f,0.5f,0.5f); } RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname, @@ -113,10 +113,10 @@ RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname, m_flag(0), m_multimode(0) { - m_shininess = 35.0; - m_specular = MT_Vector3(0.5,0.5,0.5); - m_specularity = 1.0; - m_diffuse = MT_Vector3(0.5,0.5,0.5); + m_shininess = 35.0f; + m_specular = MT_Vector3(0.5f,0.5f,0.5f); + m_specularity = 1.0f; + m_diffuse = MT_Vector3(0.5f,0.5f,0.5f); } diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index e960131c1fb..aa32f625475 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -422,7 +422,7 @@ public: /** * Render Tools */ - virtual void applyTransform(double *oglmatrix, int drawingmode) = 0; + virtual void applyTransform(float *oglmatrix, int drawingmode) = 0; /** * Renders 2D boxes. diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp index 13d49c53423..9cd8f77adfd 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp @@ -58,7 +58,7 @@ RAS_MeshSlot::RAS_MeshSlot() : SG_QList() m_bVisible = false; m_bCulled = true; m_bObjectColor = false; - m_RGBAcolor = MT_Vector4(0.0, 0.0, 0.0, 0.0); + m_RGBAcolor = MT_Vector4(0.0f, 0.0f, 0.0f, 0.0f); m_DisplayList = NULL; m_bDisplayList = true; m_joinSlot = NULL; diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h index 1eee99f896b..75cc382c78c 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h @@ -128,7 +128,7 @@ public: void* m_clientObj; RAS_Deformer* m_pDeformer; DerivedMesh* m_pDerivedMesh; - double* m_OpenGLMatrix; + float* m_OpenGLMatrix; // visibility bool m_bVisible; bool m_bCulled; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp index 4ac1c9c4ebb..8319b75331f 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp @@ -100,13 +100,13 @@ bool RAS_OpenGLLight::ApplyFixedFunctionLighting(KX_Scene *kxscene, int oblayer, //vec[0] = base->object->obmat[2][0]; //vec[1] = base->object->obmat[2][1]; //vec[2] = base->object->obmat[2][2]; - vec[3] = 0.0; + vec[3] = 0.0f; glLightfv((GLenum)(GL_LIGHT0+slot), GL_POSITION, vec); } else { - //vec[3] = 1.0; + //vec[3] = 1.0f; glLightfv((GLenum)(GL_LIGHT0+slot), GL_POSITION, vec); - glLightf((GLenum)(GL_LIGHT0+slot), GL_CONSTANT_ATTENUATION, 1.0); + glLightf((GLenum)(GL_LIGHT0+slot), GL_CONSTANT_ATTENUATION, 1.0f); glLightf((GLenum)(GL_LIGHT0+slot), GL_LINEAR_ATTENUATION, m_att1/m_distance); // without this next line it looks backward compatible. //attennuation still is acceptable @@ -124,30 +124,30 @@ bool RAS_OpenGLLight::ApplyFixedFunctionLighting(KX_Scene *kxscene, int oblayer, glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_EXPONENT, 128.0f * m_spotblend); } else { - glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, 180.0); + glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, 180.0f); } } if (m_nodiffuse) { - vec[0] = vec[1] = vec[2] = vec[3] = 0.0; + vec[0] = vec[1] = vec[2] = vec[3] = 0.0f; } else { vec[0] = m_energy*m_color[0]; vec[1] = m_energy*m_color[1]; vec[2] = m_energy*m_color[2]; - vec[3] = 1.0; + vec[3] = 1.0f; } glLightfv((GLenum)(GL_LIGHT0+slot), GL_DIFFUSE, vec); if (m_nospecular) { - vec[0] = vec[1] = vec[2] = vec[3] = 0.0; + vec[0] = vec[1] = vec[2] = vec[3] = 0.0f; } else if (m_nodiffuse) { vec[0] = m_energy*m_color[0]; vec[1] = m_energy*m_color[1]; vec[2] = m_energy*m_color[2]; - vec[3] = 1.0; + vec[3] = 1.0f; } glLightfv((GLenum)(GL_LIGHT0+slot), GL_SPECULAR, vec); @@ -262,7 +262,7 @@ void RAS_OpenGLLight::Update() // lights don't get their openGL matrix updated, do it now if (kxlight->GetSGNode()->IsDirty()) kxlight->GetOpenGLMatrix(); - double *dobmat = kxlight->GetOpenGLMatrixPtr()->getPointer(); + float *dobmat = kxlight->GetOpenGLMatrixPtr()->getPointer(); for (int i=0; i<4; i++) for (int j=0; j<4; j++, dobmat++) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index bbdf17b5bc4..e7b5bebd5e8 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -89,17 +89,17 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas, RAS_STORAGE_TYPE :RAS_IRasterizer(canvas), m_2DCanvas(canvas), m_fogenabled(false), - m_time(0.0), + m_time(0.0f), m_campos(0.0f, 0.0f, 0.0f), m_camortho(false), m_stereomode(RAS_STEREO_NOSTEREO), m_curreye(RAS_STEREO_LEFTEYE), - m_eyeseparation(0.0), - m_focallength(0.0), + m_eyeseparation(0.0f), + m_focallength(0.0f), m_setfocallength(false), m_noOfScanlines(32), m_motionblur(0), - m_motionblurvalue(-1.0), + m_motionblurvalue(-1.0f), m_usingoverrideshader(false), m_clientobject(NULL), m_auxilaryClientInfo(NULL), @@ -171,10 +171,10 @@ bool RAS_OpenGLRasterizer::Init() glFrontFace(GL_CCW); m_last_frontface = true; - m_redback = 0.4375; - m_greenback = 0.4375; - m_blueback = 0.4375; - m_alphaback = 0.0; + m_redback = 0.4375f; + m_greenback = 0.4375f; + m_blueback = 0.4375f; + m_alphaback = 0.0f; glClearColor(m_redback,m_greenback,m_blueback,m_alphaback); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); @@ -249,7 +249,7 @@ void RAS_OpenGLRasterizer::Exit() glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); - glClearDepth(1.0); + glClearDepth(1.0f); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glClearColor(m_redback, m_greenback, m_blueback, m_alphaback); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -371,8 +371,8 @@ void RAS_OpenGLRasterizer::FlushDebugShapes(SCA_IScene *scene) glColor4f(debugShapes[i].m_color[0], debugShapes[i].m_color[1], debugShapes[i].m_color[2], 1.0f); const MT_Scalar *fromPtr = &debugShapes[i].m_pos.x(); const MT_Scalar *toPtr= &debugShapes[i].m_param.x(); - glVertex3dv(fromPtr); - glVertex3dv(toPtr); + glVertex3fv(fromPtr); + glVertex3fv(toPtr); } glEnd(); @@ -383,7 +383,7 @@ void RAS_OpenGLRasterizer::FlushDebugShapes(SCA_IScene *scene) glBegin(GL_LINE_LOOP); glColor4f(debugShapes[i].m_color[0], debugShapes[i].m_color[1], debugShapes[i].m_color[2], 1.0f); - static const MT_Vector3 worldUp(0.0, 0.0, 1.0); + static const MT_Vector3 worldUp(0.0f, 0.0f, 1.0f); MT_Vector3 norm = debugShapes[i].m_param; MT_Matrix3x3 tr; if (norm.fuzzyZero() || norm == worldUp) @@ -403,12 +403,12 @@ void RAS_OpenGLRasterizer::FlushDebugShapes(SCA_IScene *scene) int n = (int)debugShapes[i].m_param2.y(); for (int j = 0; j<n; j++) { - MT_Scalar theta = j*M_PI*2/n; - MT_Vector3 pos(cos(theta) * rad, sin(theta) * rad, 0.0); + MT_Scalar theta = j*(float)M_PI*2/n; + MT_Vector3 pos(cos(theta) * rad, sin(theta) * rad, 0.0f); pos = pos*tr; pos += debugShapes[i].m_pos; const MT_Scalar* posPtr = &pos.x(); - glVertex3dv(posPtr); + glVertex3fv(posPtr); } glEnd(); } @@ -546,7 +546,7 @@ void RAS_OpenGLRasterizer::SetEye(const StereoEye eye) glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); } else { - //glAccum(GL_LOAD, 1.0); + //glAccum(GL_LOAD, 1.0f); glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE); ClearDepthBuffer(); } @@ -823,22 +823,22 @@ void RAS_OpenGLRasterizer::DrawDerivedMesh(class RAS_MeshSlot &ms) void RAS_OpenGLRasterizer::SetProjectionMatrix(MT_CmMatrix4x4 &mat) { glMatrixMode(GL_PROJECTION); - double* matrix = &mat(0, 0); - glLoadMatrixd(matrix); + float* matrix = &mat(0, 0); + glLoadMatrixf(matrix); - m_camortho = (mat(3, 3) != 0.0); + m_camortho = (mat(3, 3) != 0.0f); } void RAS_OpenGLRasterizer::SetProjectionMatrix(const MT_Matrix4x4 & mat) { glMatrixMode(GL_PROJECTION); - double matrix[16]; + float matrix[16]; /* Get into argument. Looks a bit dodgy, but it's ok. */ mat.getValue(matrix); /* Internally, MT_Matrix4x4 uses doubles (MT_Scalar). */ - glLoadMatrixd(matrix); + glLoadMatrixf(matrix); - m_camortho= (mat[3][3] != 0.0); + m_camortho= (mat[3][3] != 0.0f); } MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( @@ -852,7 +852,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( bool ) { MT_Matrix4x4 result; - double mat[16]; + float mat[16]; // correction for stereo if (Stereo()) @@ -891,7 +891,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( glLoadIdentity(); glFrustum(left, right, bottom, top, frustnear, frustfar); - glGetDoublev(GL_PROJECTION_MATRIX, mat); + glGetFloatv(GL_PROJECTION_MATRIX, mat); result.setValue(mat); return result; @@ -906,14 +906,14 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetOrthoMatrix( float frustfar ) { MT_Matrix4x4 result; - double mat[16]; + float mat[16]; // stereo is meaning less for orthographic, disable it glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(left, right, bottom, top, frustnear, frustfar); - glGetDoublev(GL_PROJECTION_MATRIX, mat); + glGetFloatv(GL_PROJECTION_MATRIX, mat); result.setValue(mat); return result; @@ -931,8 +931,8 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, // correction for stereo if (Stereo() && perspective) { - MT_Vector3 unitViewDir(0.0, -1.0, 0.0); // minus y direction, Blender convention - MT_Vector3 unitViewupVec(0.0, 0.0, 1.0); + MT_Vector3 unitViewDir(0.0f, -1.0f, 0.0f); // minus y direction, Blender convention + MT_Vector3 unitViewupVec(0.0f, 0.0f, 1.0f); MT_Vector3 viewDir, viewupVec; MT_Vector3 eyeline; @@ -950,7 +950,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, // translate to left by half the eye distance MT_Transform transform; transform.setIdentity(); - transform.translate(-(eyeline * m_eyeseparation / 2.0)); + transform.translate(-(eyeline * m_eyeseparation / 2.0f)); m_viewmatrix *= transform; } break; @@ -959,7 +959,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, // translate to right by half the eye distance MT_Transform transform; transform.setIdentity(); - transform.translate(eyeline * m_eyeseparation / 2.0); + transform.translate(eyeline * m_eyeseparation / 2.0f); m_viewmatrix *= transform; } break; @@ -974,7 +974,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, m_viewmatrix.getValue(glviewmat); glMatrixMode(GL_MODELVIEW); - glLoadMatrixd(glviewmat); + glLoadMatrixf(glviewmat); m_campos = pos; } @@ -1066,7 +1066,7 @@ void RAS_OpenGLRasterizer::EnableMotionBlur(float motionblurvalue) void RAS_OpenGLRasterizer::DisableMotionBlur() { m_motionblur = 0; - m_motionblurvalue = -1.0; + m_motionblurvalue = -1.0f; } void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend) @@ -1287,7 +1287,7 @@ void RAS_OpenGLRasterizer::RemoveLight(RAS_ILightObject* lightobject) m_lights.erase(lit); } -bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast *result, double *oglmatrix) +bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast *result, float *oglmatrix) { if (result->m_hitMesh) { @@ -1301,14 +1301,14 @@ bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast left = (dir.cross(resultnormal)).safe_normalized(); // for the up vector, we take the 'resultnormal' returned by the physics - double maat[16] = {left[0], left[1], left[2], 0, + float maat[16] = {left[0], left[1], left[2], 0, dir[0], dir[1], dir[2], 0, resultnormal[0], resultnormal[1], resultnormal[2], 0, 0, 0, 0, 1}; - glTranslated(oglmatrix[12],oglmatrix[13],oglmatrix[14]); + glTranslatef(oglmatrix[12],oglmatrix[13],oglmatrix[14]); //glMultMatrixd(oglmatrix); - glMultMatrixd(maat); + glMultMatrixf(maat); return true; } else { @@ -1316,7 +1316,7 @@ bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast } } -void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode ) +void RAS_OpenGLRasterizer::applyTransform(float* oglmatrix,int objectdrawmode ) { /* FIXME: blender: intern/moto/include/MT_Vector3.inl:42: MT_Vector3 operator/(const @@ -1337,14 +1337,14 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode ) //page 360/361 3D Game Engine Design, David Eberly for a discussion // on screen aligned and axis aligned billboards // assumed is that the preprocessor transformed all billboard polygons - // so that their normal points into the positive x direction (1.0, 0.0, 0.0) + // so that their normal points into the positive x direction (1.0f, 0.0f, 0.0f) // when new parenting for objects is done, this rotation // will be moved into the object MT_Point3 objpos (oglmatrix[12],oglmatrix[13],oglmatrix[14]); MT_Point3 campos = GetCameraPosition(); MT_Vector3 dir = (campos - objpos).safe_normalized(); - MT_Vector3 up(0,0,1.0); + MT_Vector3 up(0,0,1.0f); KX_GameObject* gameobj = (KX_GameObject*)m_clientobject; // get scaling of halo object @@ -1369,13 +1369,13 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode ) dir *= size[1]; up *= size[2]; - double maat[16] = {left[0], left[1], left[2], 0, + float maat[16] = {left[0], left[1], left[2], 0, dir[0], dir[1], dir[2], 0, up[0], up[1], up[2], 0, 0, 0, 0, 1}; glTranslatef(objpos[0],objpos[1],objpos[2]); - glMultMatrixd(maat); + glMultMatrixf(maat); } else { @@ -1399,11 +1399,11 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode ) if (!physics_controller && parent) physics_controller = parent->GetPhysicsController(); - KX_RayCast::Callback<RAS_OpenGLRasterizer, double> callback(this, physics_controller, oglmatrix); + KX_RayCast::Callback<RAS_OpenGLRasterizer, float> callback(this, physics_controller, oglmatrix); if (!KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback)) { // couldn't find something to cast the shadow on... - glMultMatrixd(oglmatrix); + glMultMatrixf(oglmatrix); } else { // we found the "ground", but the cast matrix doesn't take @@ -1415,7 +1415,7 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode ) { // 'normal' object - glMultMatrixd(oglmatrix); + glMultMatrixf(oglmatrix); } } } @@ -1591,13 +1591,13 @@ void RAS_OpenGLRasterizer::MotionBlur() if (state==1) { //bugfix:load color buffer into accum buffer for the first time(state=1) - glAccum(GL_LOAD, 1.0); + glAccum(GL_LOAD, 1.0f); SetMotionBlurState(2); } else if (motionblurvalue >= 0.0f && motionblurvalue <= 1.0f) { glAccum(GL_MULT, motionblurvalue); glAccum(GL_ACCUM, 1-motionblurvalue); - glAccum(GL_RETURN, 1.0); + glAccum(GL_RETURN, 1.0f); glFlush(); } } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index 1b012a61355..d6b2c3c8a30 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -301,13 +301,13 @@ public: void RenderText2D(RAS_TEXT_RENDER_MODE mode, const char *text, int xco, int yco, int width, int height); - void applyTransform(double *oglmatrix, int objectdrawmode); + void applyTransform(float *oglmatrix, int objectdrawmode); void PushMatrix(); void PopMatrix(); /// \see KX_RayCast - bool RayHit(struct KX_ClientObjectInfo *client, class KX_RayCast *result, double *oglmatrix); + bool RayHit(struct KX_ClientObjectInfo *client, class KX_RayCast *result, float *oglmatrix); /// \see KX_RayCast bool NeedRayCast(struct KX_ClientObjectInfo *, void *UNUSED(data)) { return true; } diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp index e6edc064200..2e176360d61 100644 --- a/source/gameengine/Rasterizer/RAS_TexVert.cpp +++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp @@ -66,10 +66,10 @@ const MT_Point3& RAS_TexVert::xyz() void RAS_TexVert::SetRGBA(const MT_Vector4& rgba) { unsigned char *colp = (unsigned char*) &m_rgba; - colp[0] = (unsigned char) (rgba[0] * 255.0); - colp[1] = (unsigned char) (rgba[1] * 255.0); - colp[2] = (unsigned char) (rgba[2] * 255.0); - colp[3] = (unsigned char) (rgba[3] * 255.0); + colp[0] = (unsigned char) (rgba[0] * 255.0f); + colp[1] = (unsigned char) (rgba[1] * 255.0f); + colp[2] = (unsigned char) (rgba[2] * 255.0f); + colp[3] = (unsigned char) (rgba[3] * 255.0f); } @@ -153,12 +153,12 @@ unsigned int RAS_TexVert::getUnit() const void RAS_TexVert::Transform(const MT_Matrix4x4& mat, const MT_Matrix4x4& nmat) { - SetXYZ((mat * MT_Vector4(m_localxyz[0], m_localxyz[1], m_localxyz[2], 1.0)).getValue()); - SetNormal((nmat * MT_Vector4(m_normal[0], m_normal[1], m_normal[2], 1.0)).getValue()); - SetTangent((nmat * MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0)).getValue()); + SetXYZ((mat * MT_Vector4(m_localxyz[0], m_localxyz[1], m_localxyz[2], 1.0f)).getValue()); + SetNormal((nmat * MT_Vector4(m_normal[0], m_normal[1], m_normal[2], 1.0f)).getValue()); + SetTangent((nmat * MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0f)).getValue()); } void RAS_TexVert::TransformUV(int index, const MT_Matrix4x4& mat) { - SetUV(index, (mat * MT_Vector4(m_uvs[index][0], m_uvs[index][1], 0.0, 1.0)).getValue()); + SetUV(index, (mat * MT_Vector4(m_uvs[index][0], m_uvs[index][1], 0.0f, 1.0f)).getValue()); } |