1 | /*
|
---|
2 | ============================================================================
|
---|
3 | This source file is part of the Ogre-Maya Tools.
|
---|
4 | Distributed as part of Ogre (Object-oriented Graphics Rendering Engine).
|
---|
5 | Copyright (C) 2003 Fifty1 Software Inc., Bytelords
|
---|
6 |
|
---|
7 | This program is free software; you can redistribute it and/or
|
---|
8 | modify it under the terms of the GNU General Public License
|
---|
9 | as published by the Free Software Foundation; either version 2
|
---|
10 | of the License, or (at your option) any later version.
|
---|
11 |
|
---|
12 | This program is distributed in the hope that it will be useful,
|
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | GNU General Public License for more details.
|
---|
16 |
|
---|
17 | You should have received a copy of the GNU General Public License
|
---|
18 | along with this program; if not, write to the Free Software
|
---|
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
20 | or go to http://www.gnu.org/licenses/gpl.txt
|
---|
21 | ============================================================================
|
---|
22 | */
|
---|
23 | #ifndef _OGREMAYA_COMMON_H_
|
---|
24 | #define _OGREMAYA_COMMON_H_
|
---|
25 |
|
---|
26 | #if defined( _MSC_VER )
|
---|
27 | // Turn off warnings generated by long std templates
|
---|
28 | // This warns about truncation to 255 characters in debug/browse info
|
---|
29 | # pragma warning (disable : 4786)
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | namespace OgreMaya {
|
---|
33 |
|
---|
34 | typedef float Real;
|
---|
35 |
|
---|
36 | template <typename Iterator>
|
---|
37 | void deleteAll(Iterator it, Iterator end) {
|
---|
38 | for(;it!=end; ++it)
|
---|
39 | delete *it;
|
---|
40 | }
|
---|
41 |
|
---|
42 | template <typename Iterator>
|
---|
43 | bool listEqual(Iterator it1, Iterator it2, Iterator end1, Iterator end2) {
|
---|
44 | bool eq = true;
|
---|
45 | while(eq && it1!=end1 && it2!=end2) {
|
---|
46 | eq = *it1 == *it2;
|
---|
47 | ++it1;
|
---|
48 | ++it2;
|
---|
49 | }
|
---|
50 |
|
---|
51 | return
|
---|
52 | eq && it1==end1 && it2==end2;
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | struct Vector3 {
|
---|
57 | Real x,y,z;
|
---|
58 |
|
---|
59 | Vector3(): x(0), y(0), z(0) {}
|
---|
60 |
|
---|
61 | bool operator ==(const Vector3& other) const {
|
---|
62 | return x==other.x && y==other.y && z==other.z;
|
---|
63 | }
|
---|
64 | };
|
---|
65 |
|
---|
66 | struct ColourValue {
|
---|
67 | Real r,g,b,a;
|
---|
68 |
|
---|
69 | ColourValue(): r(0), g(0), b(0), a(1) {}
|
---|
70 |
|
---|
71 | bool operator ==(const ColourValue& other) const {
|
---|
72 | return r==other.r && g==other.g && b==other.b && a==other.a;
|
---|
73 | }
|
---|
74 | };
|
---|
75 |
|
---|
76 | }
|
---|
77 |
|
---|
78 | #endif
|
---|