b3Defines.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. // MISC defines, see BKE_global.h, BKE_utildefines.h
  22. #define B3_SIZEOFBLENDERHEADER 12
  23. // ------------------------------------------------------------
  24. #if defined(__sgi) || defined (__sparc) || defined (__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
  25. # define B3_MAKE_ID(a,b,c,d) ( (int)(a)<<24 | (int)(b)<<16 | (c)<<8 | (d) )
  26. #else
  27. # define B3_MAKE_ID(a,b,c,d) ( (int)(d)<<24 | (int)(c)<<16 | (b)<<8 | (a) )
  28. #endif
  29. // ------------------------------------------------------------
  30. #if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
  31. # define B3_MAKE_ID2(c, d) ( (c)<<8 | (d) )
  32. #else
  33. # define B3_MAKE_ID2(c, d) ( (d)<<8 | (c) )
  34. #endif
  35. // ------------------------------------------------------------
  36. #define B3_ID_SCE B3_MAKE_ID2('S', 'C')
  37. #define B3_ID_LI B3_MAKE_ID2('L', 'I')
  38. #define B3_ID_OB B3_MAKE_ID2('O', 'B')
  39. #define B3_ID_ME B3_MAKE_ID2('M', 'E')
  40. #define B3_ID_CU B3_MAKE_ID2('C', 'U')
  41. #define B3_ID_MB B3_MAKE_ID2('M', 'B')
  42. #define B3_ID_MA B3_MAKE_ID2('M', 'A')
  43. #define B3_ID_TE B3_MAKE_ID2('T', 'E')
  44. #define B3_ID_IM B3_MAKE_ID2('I', 'M')
  45. #define B3_ID_IK B3_MAKE_ID2('I', 'K')
  46. #define B3_ID_WV B3_MAKE_ID2('W', 'V')
  47. #define B3_ID_LT B3_MAKE_ID2('L', 'T')
  48. #define B3_ID_SE B3_MAKE_ID2('S', 'E')
  49. #define B3_ID_LF B3_MAKE_ID2('L', 'F')
  50. #define B3_ID_LA B3_MAKE_ID2('L', 'A')
  51. #define B3_ID_CA B3_MAKE_ID2('C', 'A')
  52. #define B3_ID_IP B3_MAKE_ID2('I', 'P')
  53. #define B3_ID_KE B3_MAKE_ID2('K', 'E')
  54. #define B3_ID_WO B3_MAKE_ID2('W', 'O')
  55. #define B3_ID_SCR B3_MAKE_ID2('S', 'R')
  56. #define B3_ID_VF B3_MAKE_ID2('V', 'F')
  57. #define B3_ID_TXT B3_MAKE_ID2('T', 'X')
  58. #define B3_ID_SO B3_MAKE_ID2('S', 'O')
  59. #define B3_ID_SAMPLE B3_MAKE_ID2('S', 'A')
  60. #define B3_ID_GR B3_MAKE_ID2('G', 'R')
  61. #define B3_ID_ID B3_MAKE_ID2('I', 'D')
  62. #define B3_ID_AR B3_MAKE_ID2('A', 'R')
  63. #define B3_ID_AC B3_MAKE_ID2('A', 'C')
  64. #define B3_ID_SCRIPT B3_MAKE_ID2('P', 'Y')
  65. #define B3_ID_FLUIDSIM B3_MAKE_ID2('F', 'S')
  66. #define B3_ID_NT B3_MAKE_ID2('N', 'T')
  67. #define B3_ID_BR B3_MAKE_ID2('B', 'R')
  68. #define B3_ID_SEQ B3_MAKE_ID2('S', 'Q')
  69. #define B3_ID_CO B3_MAKE_ID2('C', 'O')
  70. #define B3_ID_PO B3_MAKE_ID2('A', 'C')
  71. #define B3_ID_NLA B3_MAKE_ID2('N', 'L')
  72. #define B3_ID_VS B3_MAKE_ID2('V', 'S')
  73. #define B3_ID_VN B3_MAKE_ID2('V', 'N')
  74. // ------------------------------------------------------------
  75. #define B3_FORM B3_MAKE_ID('F','O','R','M')
  76. #define B3_DDG1 B3_MAKE_ID('3','D','G','1')
  77. #define B3_DDG2 B3_MAKE_ID('3','D','G','2')
  78. #define B3_DDG3 B3_MAKE_ID('3','D','G','3')
  79. #define B3_DDG4 B3_MAKE_ID('3','D','G','4')
  80. #define B3_GOUR B3_MAKE_ID('G','O','U','R')
  81. #define B3_BLEN B3_MAKE_ID('B','L','E','N')
  82. #define B3_DER_ B3_MAKE_ID('D','E','R','_')
  83. #define B3_V100 B3_MAKE_ID('V','1','0','0')
  84. #define B3_DATA B3_MAKE_ID('D','A','T','A')
  85. #define B3_GLOB B3_MAKE_ID('G','L','O','B')
  86. #define B3_IMAG B3_MAKE_ID('I','M','A','G')
  87. #define B3_TEST B3_MAKE_ID('T','E','S','T')
  88. #define B3_USER B3_MAKE_ID('U','S','E','R')
  89. // ------------------------------------------------------------
  90. #define B3_DNA1 B3_MAKE_ID('D','N','A','1')
  91. #define B3_REND B3_MAKE_ID('R','E','N','D')
  92. #define B3_ENDB B3_MAKE_ID('E','N','D','B')
  93. #define B3_NAME B3_MAKE_ID('N','A','M','E')
  94. #define B3_SDNA B3_MAKE_ID('S','D','N','A')
  95. #define B3_TYPE B3_MAKE_ID('T','Y','P','E')
  96. #define B3_TLEN B3_MAKE_ID('T','L','E','N')
  97. #define B3_STRC B3_MAKE_ID('S','T','R','C')
  98. // ------------------------------------------------------------
  99. #define B3_SWITCH_INT(a) { \
  100. char s_i, *p_i; \
  101. p_i= (char *)&(a); \
  102. s_i=p_i[0]; p_i[0]=p_i[3]; p_i[3]=s_i; \
  103. s_i=p_i[1]; p_i[1]=p_i[2]; p_i[2]=s_i; }
  104. // ------------------------------------------------------------
  105. #define B3_SWITCH_SHORT(a) { \
  106. char s_i, *p_i; \
  107. p_i= (char *)&(a); \
  108. s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; }
  109. // ------------------------------------------------------------
  110. #define B3_SWITCH_LONGINT(a) { \
  111. char s_i, *p_i; \
  112. p_i= (char *)&(a); \
  113. s_i=p_i[0]; p_i[0]=p_i[7]; p_i[7]=s_i; \
  114. s_i=p_i[1]; p_i[1]=p_i[6]; p_i[6]=s_i; \
  115. s_i=p_i[2]; p_i[2]=p_i[5]; p_i[5]=s_i; \
  116. s_i=p_i[3]; p_i[3]=p_i[4]; p_i[4]=s_i; }
  117. #endif//__B_DEFINES_H__