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:
Diffstat (limited to 'intern/moto/include')
-rw-r--r--intern/moto/include/GEN_List.h28
-rw-r--r--intern/moto/include/GEN_Map.h31
-rw-r--r--intern/moto/include/MT_Matrix3x3.h20
-rw-r--r--intern/moto/include/MT_Matrix4x4.h1
-rw-r--r--intern/moto/include/MT_Matrix4x4.inl14
-rw-r--r--intern/moto/include/MT_random.h6
6 files changed, 62 insertions, 38 deletions
diff --git a/intern/moto/include/GEN_List.h b/intern/moto/include/GEN_List.h
index 2bc09e44c70..9eb3901a7d5 100644
--- a/intern/moto/include/GEN_List.h
+++ b/intern/moto/include/GEN_List.h
@@ -26,34 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/**
- * $Id$
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
#ifndef GEN_LIST_H
#define GEN_LIST_H
diff --git a/intern/moto/include/GEN_Map.h b/intern/moto/include/GEN_Map.h
index db3335d6110..d85e9af175b 100644
--- a/intern/moto/include/GEN_Map.h
+++ b/intern/moto/include/GEN_Map.h
@@ -50,6 +50,19 @@ public:
m_buckets[i] = 0;
}
}
+
+ GEN_Map(const GEN_Map& map)
+ {
+ m_num_buckets = map.m_num_buckets;
+ m_buckets = new Entry *[m_num_buckets];
+
+ for (int i = 0; i < m_num_buckets; ++i) {
+ m_buckets[i] = 0;
+
+ for(Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next)
+ insert(entry->m_key, entry->m_value);
+ }
+ }
int size() {
int count=0;
@@ -82,6 +95,24 @@ public:
}
return 0;
}
+
+ Key* getKey(int index) {
+ int count=0;
+ for (int i=0;i<m_num_buckets;i++)
+ {
+ Entry* bucket = m_buckets[i];
+ while(bucket)
+ {
+ if (count==index)
+ {
+ return &bucket->m_key;
+ }
+ bucket = bucket->m_next;
+ count++;
+ }
+ }
+ return 0;
+ }
void clear() {
for (int i = 0; i < m_num_buckets; ++i) {
diff --git a/intern/moto/include/MT_Matrix3x3.h b/intern/moto/include/MT_Matrix3x3.h
index 3197103a267..899a2731588 100644
--- a/intern/moto/include/MT_Matrix3x3.h
+++ b/intern/moto/include/MT_Matrix3x3.h
@@ -144,6 +144,26 @@ public:
-sj, cj * si, cj * ci);
}
+ 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) {
+ 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;
+ yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2]));
+ }
+ else {
+ pitch = - MT_PI / 2.0;
+ yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2]));
+ }
+ }
+ }
+
void scale(MT_Scalar x, MT_Scalar y, MT_Scalar z) {
m_el[0][0] *= x; m_el[0][1] *= y; m_el[0][2] *= z;
m_el[1][0] *= x; m_el[1][1] *= y; m_el[1][2] *= z;
diff --git a/intern/moto/include/MT_Matrix4x4.h b/intern/moto/include/MT_Matrix4x4.h
index 823541347b7..b4ee84a718b 100644
--- a/intern/moto/include/MT_Matrix4x4.h
+++ b/intern/moto/include/MT_Matrix4x4.h
@@ -212,6 +212,7 @@ public:
MT_Matrix4x4 transposed() const;
void transpose();
+ MT_Matrix4x4 inverse() const;
void invert();
protected:
diff --git a/intern/moto/include/MT_Matrix4x4.inl b/intern/moto/include/MT_Matrix4x4.inl
index a2aa893a6b3..074bd6e4b05 100644
--- a/intern/moto/include/MT_Matrix4x4.inl
+++ b/intern/moto/include/MT_Matrix4x4.inl
@@ -52,14 +52,14 @@ GEN_INLINE void MT_Matrix4x4::invert() {
}
}
-/* We do things slightly different here, because the invert() modifies
- * the buffer itself. This makes it impossible to make this op right
- * away. Like other, still missing facilities, I will repair this
- * later. */
-/* GEN_INLINE T_Matrix4x4 MT_Matrix4x4::inverse() const */
-/* { */
-/* } */
+GEN_INLINE MT_Matrix4x4 MT_Matrix4x4::inverse() const
+{
+ MT_Matrix4x4 invmat = *this;
+
+ invmat.invert();
+ return invmat;
+}
GEN_INLINE MT_Matrix4x4& MT_Matrix4x4::operator*=(const MT_Matrix4x4& m)
{
diff --git a/intern/moto/include/MT_random.h b/intern/moto/include/MT_random.h
index d7da546cf03..3afe1dd1662 100644
--- a/intern/moto/include/MT_random.h
+++ b/intern/moto/include/MT_random.h
@@ -31,10 +31,10 @@
#include <limits.h>
-#define MT_RAND_MAX ULONG_MAX
+#define MT_RAND_MAX UINT_MAX
-extern void MT_srand(unsigned long);
-extern unsigned long MT_rand();
+extern void MT_srand(unsigned int);
+extern unsigned int MT_rand();
#endif