Bullet Collision Detection & Physics Library
bDefines.h
Go to the documentation of this file.
1 /* Copyright (C) 2006-2009 Charlie C & Erwin Coumans http://gamekit.googlecode.com
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 *
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 * 2. Altered source versions must be plainly marked as such, and must not be
16 * misrepresented as being the original software.
17 * 3. This notice may not be removed or altered from any source distribution.
18 */
19 #ifndef __B_DEFINES_H__
20 #define __B_DEFINES_H__
21 
22 // MISC defines, see BKE_global.h, BKE_utildefines.h
23 #define SIZEOFBLENDERHEADER 12
24 
25 // ------------------------------------------------------------
26 #if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined(__PPC__) || defined(__ppc__) || defined(__BIG_ENDIAN__)
27 #define MAKE_ID(a, b, c, d) ((int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d))
28 #else
29 #define MAKE_ID(a, b, c, d) ((int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a))
30 #endif
31 
32 // ------------------------------------------------------------
33 #if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined(__PPC__) || defined(__ppc__) || defined(__BIG_ENDIAN__)
34 #define MAKE_ID2(c, d) ((c) << 8 | (d))
35 #define MOST_SIG_BYTE 0
36 #define BBIG_ENDIAN
37 #else
38 #define MAKE_ID2(c, d) ((d) << 8 | (c))
39 #define MOST_SIG_BYTE 1
40 #define BLITTLE_ENDIAN
41 #endif
42 
43 // ------------------------------------------------------------
44 #define ID_SCE MAKE_ID2('S', 'C')
45 #define ID_LI MAKE_ID2('L', 'I')
46 #define ID_OB MAKE_ID2('O', 'B')
47 #define ID_ME MAKE_ID2('M', 'E')
48 #define ID_CU MAKE_ID2('C', 'U')
49 #define ID_MB MAKE_ID2('M', 'B')
50 #define ID_MA MAKE_ID2('M', 'A')
51 #define ID_TE MAKE_ID2('T', 'E')
52 #define ID_IM MAKE_ID2('I', 'M')
53 #define ID_IK MAKE_ID2('I', 'K')
54 #define ID_WV MAKE_ID2('W', 'V')
55 #define ID_LT MAKE_ID2('L', 'T')
56 #define ID_SE MAKE_ID2('S', 'E')
57 #define ID_LF MAKE_ID2('L', 'F')
58 #define ID_LA MAKE_ID2('L', 'A')
59 #define ID_CA MAKE_ID2('C', 'A')
60 #define ID_IP MAKE_ID2('I', 'P')
61 #define ID_KE MAKE_ID2('K', 'E')
62 #define ID_WO MAKE_ID2('W', 'O')
63 #define ID_SCR MAKE_ID2('S', 'R')
64 #define ID_VF MAKE_ID2('V', 'F')
65 #define ID_TXT MAKE_ID2('T', 'X')
66 #define ID_SO MAKE_ID2('S', 'O')
67 #define ID_SAMPLE MAKE_ID2('S', 'A')
68 #define ID_GR MAKE_ID2('G', 'R')
69 #define ID_ID MAKE_ID2('I', 'D')
70 #define ID_AR MAKE_ID2('A', 'R')
71 #define ID_AC MAKE_ID2('A', 'C')
72 #define ID_SCRIPT MAKE_ID2('P', 'Y')
73 #define ID_FLUIDSIM MAKE_ID2('F', 'S')
74 #define ID_NT MAKE_ID2('N', 'T')
75 #define ID_BR MAKE_ID2('B', 'R')
76 
77 #define ID_SEQ MAKE_ID2('S', 'Q')
78 #define ID_CO MAKE_ID2('C', 'O')
79 #define ID_PO MAKE_ID2('A', 'C')
80 #define ID_NLA MAKE_ID2('N', 'L')
81 
82 #define ID_VS MAKE_ID2('V', 'S')
83 #define ID_VN MAKE_ID2('V', 'N')
84 
85 // ------------------------------------------------------------
86 #define FORM MAKE_ID('F', 'O', 'R', 'M')
87 #define DDG1 MAKE_ID('3', 'D', 'G', '1')
88 #define DDG2 MAKE_ID('3', 'D', 'G', '2')
89 #define DDG3 MAKE_ID('3', 'D', 'G', '3')
90 #define DDG4 MAKE_ID('3', 'D', 'G', '4')
91 #define GOUR MAKE_ID('G', 'O', 'U', 'R')
92 #define BLEN MAKE_ID('B', 'L', 'E', 'N')
93 #define DER_ MAKE_ID('D', 'E', 'R', '_')
94 #define V100 MAKE_ID('V', '1', '0', '0')
95 #define DATA MAKE_ID('D', 'A', 'T', 'A')
96 #define GLOB MAKE_ID('G', 'L', 'O', 'B')
97 #define IMAG MAKE_ID('I', 'M', 'A', 'G')
98 #define USER MAKE_ID('U', 'S', 'E', 'R')
99 
100 // ------------------------------------------------------------
101 #define DNA1 MAKE_ID('D', 'N', 'A', '1')
102 #define REND MAKE_ID('R', 'E', 'N', 'D')
103 #define ENDB MAKE_ID('E', 'N', 'D', 'B')
104 #define NAME MAKE_ID('N', 'A', 'M', 'E')
105 #define SDNA MAKE_ID('S', 'D', 'N', 'A')
106 #define TYPE MAKE_ID('T', 'Y', 'P', 'E')
107 #define TLEN MAKE_ID('T', 'L', 'E', 'N')
108 #define STRC MAKE_ID('S', 'T', 'R', 'C')
109 
110 // ------------------------------------------------------------
111 #define SWITCH_INT(a) \
112  { \
113  char s_i, *p_i; \
114  p_i = (char *)&(a); \
115  s_i = p_i[0]; \
116  p_i[0] = p_i[3]; \
117  p_i[3] = s_i; \
118  s_i = p_i[1]; \
119  p_i[1] = p_i[2]; \
120  p_i[2] = s_i; \
121  }
122 
123 // ------------------------------------------------------------
124 #define SWITCH_SHORT(a) \
125  { \
126  char s_i, *p_i; \
127  p_i = (char *)&(a); \
128  s_i = p_i[0]; \
129  p_i[0] = p_i[1]; \
130  p_i[1] = s_i; \
131  }
132 
133 // ------------------------------------------------------------
134 #define SWITCH_LONGINT(a) \
135  { \
136  char s_i, *p_i; \
137  p_i = (char *)&(a); \
138  s_i = p_i[0]; \
139  p_i[0] = p_i[7]; \
140  p_i[7] = s_i; \
141  s_i = p_i[1]; \
142  p_i[1] = p_i[6]; \
143  p_i[6] = s_i; \
144  s_i = p_i[2]; \
145  p_i[2] = p_i[5]; \
146  p_i[5] = s_i; \
147  s_i = p_i[3]; \
148  p_i[3] = p_i[4]; \
149  p_i[4] = s_i; \
150  }
151 
152 #endif //__B_DEFINES_H__