constants.py 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. '''
  2. All constant data used in the package should be defined here.
  3. '''
  4. from collections import OrderedDict as BASE_DICT
  5. BLENDING_TYPES = type('Blending', (), {
  6. 'NONE': 'NoBlending',
  7. 'NORMAL': 'NormalBlending',
  8. 'ADDITIVE': 'AdditiveBlending',
  9. 'SUBTRACTIVE': 'SubtractiveBlending',
  10. 'MULTIPLY': 'MultiplyBlending',
  11. 'CUSTOM': 'CustomBlending'
  12. })
  13. NEAREST_FILTERS = type('NearestFilters', (), {
  14. 'NEAREST': 'NearestFilter',
  15. 'MIP_MAP_NEAREST': 'NearestMipMapNearestFilter',
  16. 'MIP_MAP_LINEAR': 'NearestMipMapLinearFilter'
  17. })
  18. LINEAR_FILTERS = type('LinearFilters', (), {
  19. 'LINEAR': 'LinearFilter',
  20. 'MIP_MAP_NEAREST': 'LinearMipMapNearestFilter',
  21. 'MIP_MAP_LINEAR': 'LinearMipMapLinearFilter'
  22. })
  23. MAPPING_TYPES = type('Mapping', (), {
  24. 'UV': 'UVMapping',
  25. 'CUBE_REFLECTION': 'CubeReflectionMapping',
  26. 'CUBE_REFRACTION': 'CubeRefractionMapping',
  27. 'SPHERICAL_REFLECTION': 'SphericalReflectionMapping',
  28. 'SPHERICAL_REFRACTION': 'SphericalRefractionMapping'
  29. })
  30. JSON = 'json'
  31. EXTENSION = '.%s' % JSON
  32. MATERIALS = 'materials'
  33. SCENE = 'scene'
  34. VERTICES = 'vertices'
  35. FACES = 'faces'
  36. NORMALS = 'normals'
  37. BONES = 'bones'
  38. UVS = 'uvs'
  39. COLORS = 'colors'
  40. MIX_COLORS = 'mixColors'
  41. SCALE = 'scale'
  42. COMPRESSION = 'compression'
  43. MAPS = 'maps'
  44. FRAME_STEP = 'frameStep'
  45. ANIMATION = 'animation'
  46. MORPH_TARGETS = 'morphTargets'
  47. SKIN_INDICES = 'skinIndices'
  48. SKIN_WEIGHTS = 'skinWeights'
  49. LOGGING = 'logging'
  50. CAMERAS = 'cameras'
  51. LIGHTS = 'lights'
  52. FACE_MATERIALS = 'faceMaterials'
  53. SKINNING = 'skinning'
  54. COPY_TEXTURES = 'copyTextures'
  55. ENABLE_PRECISION = 'enablePrecision'
  56. PRECISION = 'precision'
  57. DEFAULT_PRECISION = 6
  58. EMBED_GEOMETRY = 'embedGeometry'
  59. EMBED_ANIMATION = 'embedAnimation'
  60. GLOBAL = 'global'
  61. BUFFER_GEOMETRY = 'BufferGeometry'
  62. GEOMETRY = 'geometry'
  63. GEOMETRY_TYPE = 'geometryType'
  64. CRITICAL = 'critical'
  65. ERROR = 'error'
  66. WARNING = 'warning'
  67. INFO = 'info'
  68. DEBUG = 'debug'
  69. NONE = 'None'
  70. MSGPACK = 'msgpack'
  71. PACK = 'pack'
  72. INFLUENCES_PER_VERTEX = 'influencesPerVertex'
  73. EXPORT_OPTIONS = {
  74. FACES: True,
  75. VERTICES: True,
  76. NORMALS: False,
  77. UVS: False,
  78. COLORS: False,
  79. MATERIALS: False,
  80. FACE_MATERIALS: False,
  81. SCALE: 1,
  82. FRAME_STEP: 1,
  83. SCENE: True,
  84. MIX_COLORS: False,
  85. COMPRESSION: None,
  86. MAPS: False,
  87. ANIMATION: False,
  88. BONES: False,
  89. SKINNING: False,
  90. MORPH_TARGETS: False,
  91. CAMERAS: False,
  92. LIGHTS: False,
  93. COPY_TEXTURES: True,
  94. LOGGING: DEBUG,
  95. ENABLE_PRECISION: False,
  96. PRECISION: DEFAULT_PRECISION,
  97. EMBED_GEOMETRY: True,
  98. EMBED_ANIMATION: True,
  99. GEOMETRY_TYPE: GEOMETRY,
  100. INFLUENCES_PER_VERTEX: 2
  101. }
  102. FORMAT_VERSION = 4.3
  103. VERSION = 'version'
  104. THREE = 'io_three'
  105. GENERATOR = 'generator'
  106. SOURCE_FILE = 'sourceFile'
  107. VALID_DATA_TYPES = (str, int, float, bool, list, tuple, dict)
  108. JSON = 'json'
  109. GZIP = 'gzip'
  110. EXTENSIONS = {
  111. JSON: '.json',
  112. MSGPACK: '.pack',
  113. GZIP: '.gz'
  114. }
  115. METADATA = 'metadata'
  116. GEOMETRIES = 'geometries'
  117. IMAGES = 'images'
  118. TEXTURE = 'texture'
  119. TEXTURES = 'textures'
  120. USER_DATA = 'userData'
  121. DATA = 'data'
  122. TYPE = 'type'
  123. MATERIAL = 'material'
  124. OBJECT = 'object'
  125. PERSPECTIVE_CAMERA = 'PerspectiveCamera'
  126. ORTHOGRAPHIC_CAMERA = 'OrthographicCamera'
  127. AMBIENT_LIGHT = 'AmbientLight'
  128. DIRECTIONAL_LIGHT = 'DirectionalLight'
  129. AREA_LIGHT = 'AreaLight'
  130. POINT_LIGHT = 'PointLight'
  131. SPOT_LIGHT = 'SpotLight'
  132. HEMISPHERE_LIGHT = 'HemisphereLight'
  133. MESH = 'Mesh'
  134. SPRITE = 'Sprite'
  135. DEFAULT_METADATA = {
  136. VERSION: FORMAT_VERSION,
  137. TYPE: OBJECT.title(),
  138. GENERATOR: THREE
  139. }
  140. UUID = 'uuid'
  141. MATRIX = 'matrix'
  142. POSITION = 'position'
  143. QUATERNION = 'quaternion'
  144. ROTATION ='rotation'
  145. SCALE = 'scale'
  146. UV = 'uv'
  147. ATTRIBUTES = 'attributes'
  148. NORMAL = 'normal'
  149. ITEM_SIZE = 'itemSize'
  150. ARRAY = 'array'
  151. FLOAT_32 = 'Float32Array'
  152. VISIBLE = 'visible'
  153. CAST_SHADOW = 'castShadow'
  154. RECEIVE_SHADOW = 'receiveShadow'
  155. QUAD = 'quad'
  156. USER_DATA = 'userData'
  157. MASK = {
  158. QUAD: 0,
  159. MATERIALS: 1,
  160. UVS: 3,
  161. NORMALS: 5,
  162. COLORS: 7
  163. }
  164. CHILDREN = 'children'
  165. URL = 'url'
  166. WRAP = 'wrap'
  167. REPEAT = 'repeat'
  168. WRAPPING = type('Wrapping', (), {
  169. 'REPEAT': 'RepeatWrapping',
  170. 'CLAMP': 'ClampToEdgeWrapping',
  171. 'MIRROR': 'MirroredRepeatWrapping'
  172. })
  173. ANISOTROPY = 'anisotropy'
  174. MAG_FILTER = 'magFilter'
  175. MIN_FILTER = 'minFilter'
  176. MAPPING = 'mapping'
  177. IMAGE = 'image'
  178. NAME = 'name'
  179. PARENT = 'parent'
  180. #@TODO move to api.constants?
  181. POS = 'pos'
  182. ROTQ = 'rotq'
  183. AMBIENT = 'ambient'
  184. COLOR = 'color'
  185. EMISSIVE = 'emissive'
  186. SPECULAR = 'specular'
  187. SPECULAR_COEF = 'specularCoef'
  188. SHININESS = 'shininess'
  189. SIDE = 'side'
  190. OPACITY = 'opacity'
  191. TRANSPARENT = 'transparent'
  192. WIREFRAME = 'wireframe'
  193. BLENDING = 'blending'
  194. VERTEX_COLORS = 'vertexColors'
  195. DEPTH_WRITE = 'depthWrite'
  196. DEPTH_TEST = 'depthTest'
  197. MAP = 'map'
  198. SPECULAR_MAP = 'specularMap'
  199. LIGHT_MAP = 'lightMap'
  200. BUMP_MAP = 'bumpMap'
  201. BUMP_SCALE = 'bumpScale'
  202. NORMAL_MAP = 'normalMap'
  203. NORMAL_SCALE = 'normalScale'
  204. #@TODO ENV_MAP, REFLECTIVITY, REFRACTION_RATIO, COMBINE
  205. MAP_DIFFUSE = 'mapDiffuse'
  206. MAP_DIFFUSE_REPEAT = 'mapDiffuseRepeat'
  207. MAP_DIFFUSE_WRAP = 'mapDiffuseWrap'
  208. MAP_DIFFUSE_ANISOTROPY = 'mapDiffuseAnisotropy'
  209. MAP_SPECULAR = 'mapSpecular'
  210. MAP_SPECULAR_REPEAT = 'mapSpecularRepeat'
  211. MAP_SPECULAR_WRAP = 'mapSpecularWrap'
  212. MAP_SPECULAR_ANISOTROPY = 'mapSpecularAnisotropy'
  213. MAP_LIGHT = 'mapLight'
  214. MAP_LIGHT_REPEAT = 'mapLightRepeat'
  215. MAP_LIGHT_WRAP = 'mapLightWrap'
  216. MAP_LIGHT_ANISOTROPY = 'mapLightAnisotropy'
  217. MAP_NORMAL = 'mapNormal'
  218. MAP_NORMAL_FACTOR = 'mapNormalFactor'
  219. MAP_NORMAL_REPEAT = 'mapNormalRepeat'
  220. MAP_NORMAL_WRAP = 'mapNormalWrap'
  221. MAP_NORMAL_ANISOTROPY = 'mapNormalAnisotropy'
  222. MAP_BUMP = 'mapBump'
  223. MAP_BUMP_REPEAT = 'mapBumpRepeat'
  224. MAP_BUMP_WRAP = 'mapBumpWrap'
  225. MAP_BUMP_ANISOTROPY = 'mapBumpAnisotropy'
  226. MAP_BUMP_SCALE = 'mapBumpScale'
  227. NORMAL_BLENDING = 0
  228. VERTEX_COLORS_ON = 2
  229. VERTEX_COLORS_OFF = 0
  230. THREE_BASIC = 'MeshBasicMaterial'
  231. THREE_LAMBERT = 'MeshLambertMaterial'
  232. THREE_PHONG = 'MeshPhongMaterial'
  233. INTENSITY = 'intensity'
  234. DISTANCE = 'distance'
  235. ASPECT = 'aspect'
  236. ANGLE = 'angle'
  237. FOV = 'fov'
  238. ASPECT = 'aspect'
  239. NEAR = 'near'
  240. FAR = 'far'
  241. LEFT = 'left'
  242. RIGHT = 'right'
  243. TOP = 'top'
  244. BOTTOM = 'bottom'
  245. SHADING = 'shading'
  246. COLOR_DIFFUSE = 'colorDiffuse'
  247. COLOR_AMBIENT = 'colorAmbient'
  248. COLOR_EMISSIVE = 'colorEmissive'
  249. COLOR_SPECULAR = 'colorSpecular'
  250. DBG_NAME = 'DbgName'
  251. DBG_COLOR = 'DbgColor'
  252. DBG_INDEX = 'DbgIndex'
  253. EMIT = 'emit'
  254. PHONG = 'phong'
  255. LAMBERT = 'lambert'
  256. BASIC = 'basic'
  257. NORMAL_BLENDING = 'NormalBlending'
  258. DBG_COLORS = (0xeeeeee, 0xee0000, 0x00ee00, 0x0000ee, 0xeeee00, 0x00eeee, 0xee00ee)
  259. DOUBLE_SIDED = 'doubleSided'