constants.py 7.9 KB
Newer Older
R
repsac 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
'''
All constant data used in the package should be defined here.
'''

from collections import OrderedDict as BASE_DICT

BLENDING_TYPES = type('Blending', (), {
    'NONE': 'NoBlending',
    'NORMAL': 'NormalBlending',
    'ADDITIVE': 'AdditiveBlending',
    'SUBTRACTIVE': 'SubtractiveBlending',
    'MULTIPLY': 'MultiplyBlending',
    'CUSTOM': 'CustomBlending'
})

NEAREST_FILTERS = type('NearestFilters', (), {
    'NEAREST': 'NearestFilter',
    'MIP_MAP_NEAREST': 'NearestMipMapNearestFilter',
    'MIP_MAP_LINEAR': 'NearestMipMapLinearFilter'
})

LINEAR_FILTERS = type('LinearFilters', (), {
    'LINEAR': 'LinearFilter',
    'MIP_MAP_NEAREST': 'LinearMipMapNearestFilter',
    'MIP_MAP_LINEAR': 'LinearMipMapLinearFilter'
})

MAPPING_TYPES = type('Mapping', (), {
    'UV': 'UVMapping',
    'CUBE_REFLECTION': 'CubeReflectionMapping',
    'CUBE_REFRACTION': 'CubeRefractionMapping',
32
    'SPHERICAL_REFLECTION': 'SphericalReflectionMapping'
R
repsac 已提交
33 34
})

35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
NUMERIC = {
    'UVMapping': 300,
    'CubeReflectionMapping': 301,
    'CubeRefractionMapping': 302,
    'EquirectangularReflectionMapping': 303,
    'EquirectangularRefractionMapping': 304,
    'SphericalReflectionMapping': 305,

    'RepeatWrapping': 1000,
    'ClampToEdgeWrapping': 1001,
    'MirroredRepeatWrapping': 1002,

    'NearestFilter': 1003,
    'NearestMipMapNearestFilter': 1004,
    'NearestMipMapLinearFilter': 1005,
    'LinearFilter': 1006,
    'LinearMipMapNearestFilter': 1007,
    'LinearMipMapLinearFilter': 1008
}
R
repsac 已提交
54 55
JSON = 'json'
EXTENSION = '.%s' % JSON
56
INDENT = 'indent'
R
repsac 已提交
57 58 59 60 61 62 63 64 65


MATERIALS = 'materials'
SCENE = 'scene'
VERTICES = 'vertices'
FACES = 'faces'
NORMALS = 'normals'
BONES = 'bones'
UVS = 'uvs'
66
APPLY_MODIFIERS = 'applyModifiers'
R
repsac 已提交
67 68
COLORS = 'colors'
MIX_COLORS = 'mixColors'
69
EXTRA_VGROUPS = 'extraVertexGroups'
70
INDEX = 'index'
71
DRAW_CALLS = 'drawcalls'
72 73 74
DC_START = 'start'
DC_COUNT = 'count'
DC_INDEX = 'index'
R
repsac 已提交
75 76 77 78
SCALE = 'scale'
COMPRESSION = 'compression'
MAPS = 'maps'
FRAME_STEP = 'frameStep'
79 80
FRAME_INDEX_AS_TIME = 'frameIndexAsTime'
ANIMATION = 'animations'
81 82
CLIPS="clips"
KEYFRAMES = 'tracks'
R
repsac 已提交
83
MORPH_TARGETS = 'morphTargets'
84 85
MORPH_TARGETS_ANIM = 'morphTargetsAnimation'
BLEND_SHAPES = 'blendShapes'
86 87
POSE = 'pose'
REST = 'rest'
R
repsac 已提交
88 89 90 91 92
SKIN_INDICES = 'skinIndices'
SKIN_WEIGHTS = 'skinWeights'
LOGGING = 'logging'
CAMERAS = 'cameras'
LIGHTS = 'lights'
R
rkusa 已提交
93
HIERARCHY = 'hierarchy'
R
repsac 已提交
94 95
FACE_MATERIALS = 'faceMaterials'
SKINNING = 'skinning'
96
EXPORT_TEXTURES = 'exportTextures'
97
EMBED_TEXTURES = 'embedTextures'
98
TEXTURE_FOLDER = 'textureFolder'
R
repsac 已提交
99 100 101
ENABLE_PRECISION = 'enablePrecision'
PRECISION = 'precision'
DEFAULT_PRECISION = 6
102
CUSTOM_PROPERTIES = 'customProperties'
R
repsac 已提交
103 104
EMBED_GEOMETRY = 'embedGeometry'
EMBED_ANIMATION = 'embedAnimation'
105
OFF = 'off'
R
repsac 已提交
106 107 108 109 110

GLOBAL = 'global'
BUFFER_GEOMETRY = 'BufferGeometry'
GEOMETRY = 'geometry'
GEOMETRY_TYPE = 'geometryType'
111
INDEX_TYPE = 'indexType'
R
repsac 已提交
112 113 114 115 116 117

CRITICAL = 'critical'
ERROR = 'error'
WARNING = 'warning'
INFO = 'info'
DEBUG = 'debug'
B
Ben Houston 已提交
118
DISABLED = 'disabled'
R
repsac 已提交
119 120 121 122 123 124

NONE = 'None'
MSGPACK = 'msgpack'

PACK = 'pack'

125 126 127 128
FLOAT_32 = 'Float32Array'
UINT_16 = 'Uint16Array'
UINT_32 = 'Uint32Array'

129 130
INFLUENCES_PER_VERTEX = 'influencesPerVertex'

R
repsac 已提交
131 132 133
EXPORT_OPTIONS = {
    FACES: True,
    VERTICES: True,
M
mese79 已提交
134 135
    NORMALS: True,
    UVS: True,
136
    APPLY_MODIFIERS: True,
R
repsac 已提交
137
    COLORS: False,
138
    EXTRA_VGROUPS: '',
139
    INDEX_TYPE: UINT_16,
140
    MATERIALS: False,
R
repsac 已提交
141 142 143
    FACE_MATERIALS: False,
    SCALE: 1,
    FRAME_STEP: 1,
144
    FRAME_INDEX_AS_TIME: False,
145
    SCENE: False,
R
repsac 已提交
146 147
    MIX_COLORS: False,
    COMPRESSION: None,
148
    MAPS: False,
149
    ANIMATION: OFF,
150
    KEYFRAMES: False,
R
repsac 已提交
151 152 153
    BONES: False,
    SKINNING: False,
    MORPH_TARGETS: False,
154
    BLEND_SHAPES: False,
R
repsac 已提交
155 156
    CAMERAS: False,
    LIGHTS: False,
R
rkusa 已提交
157
    HIERARCHY: False,
158
    EXPORT_TEXTURES: True,
159
    EMBED_TEXTURES: False,
160
    TEXTURE_FOLDER: '',
R
repsac 已提交
161
    LOGGING: DEBUG,
162
    ENABLE_PRECISION: False,
R
repsac 已提交
163
    PRECISION: DEFAULT_PRECISION,
164
    CUSTOM_PROPERTIES: False,
R
repsac 已提交
165 166
    EMBED_GEOMETRY: True,
    EMBED_ANIMATION: True,
167
    GEOMETRY_TYPE: BUFFER_GEOMETRY,
168 169
    INFLUENCES_PER_VERTEX: 2,
    INDENT: True
R
repsac 已提交
170 171 172
}


B
Ben Houston 已提交
173
FORMAT_VERSION = 4.4
R
repsac 已提交
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
VERSION = 'version'
THREE = 'io_three'
GENERATOR = 'generator'
SOURCE_FILE = 'sourceFile'
VALID_DATA_TYPES = (str, int, float, bool, list, tuple, dict)

JSON = 'json'
GZIP = 'gzip'

EXTENSIONS = {
    JSON: '.json',
    MSGPACK: '.pack',
    GZIP: '.gz'
}

METADATA = 'metadata'
GEOMETRIES = 'geometries'
IMAGES = 'images'
TEXTURE = 'texture'
TEXTURES = 'textures'

USER_DATA = 'userData'
DATA = 'data'
TYPE = 'type'

MATERIAL = 'material'
OBJECT = 'object'
PERSPECTIVE_CAMERA = 'PerspectiveCamera'
ORTHOGRAPHIC_CAMERA = 'OrthographicCamera'
AMBIENT_LIGHT = 'AmbientLight'
DIRECTIONAL_LIGHT = 'DirectionalLight'
POINT_LIGHT = 'PointLight'
SPOT_LIGHT = 'SpotLight'
207 208
# TODO (abelnation): confirm this is correct area light string for exporter
RECT_AREA_LIGHT = 'RectAreaLight'
R
repsac 已提交
209
HEMISPHERE_LIGHT = 'HemisphereLight'
210
# TODO: RectAreaLight support
R
repsac 已提交
211
MESH = 'Mesh'
R
rkusa 已提交
212
EMPTY = 'Empty'
R
repsac 已提交
213 214 215 216 217 218 219 220 221 222 223 224 225
SPRITE = 'Sprite'

DEFAULT_METADATA = {
    VERSION: FORMAT_VERSION,
    TYPE: OBJECT.title(),
    GENERATOR: THREE
}

UUID = 'uuid'

MATRIX = 'matrix'
POSITION = 'position'
QUATERNION = 'quaternion'
226
ROTATION = 'rotation'
R
repsac 已提交
227 228 229
SCALE = 'scale'

UV = 'uv'
230
UV2 = 'uv2'
R
repsac 已提交
231 232 233 234 235
ATTRIBUTES = 'attributes'
NORMAL = 'normal'
ITEM_SIZE = 'itemSize'
ARRAY = 'array'

236 237
FLOAT_32 = 'Float32Array'

R
repsac 已提交
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
VISIBLE = 'visible'
CAST_SHADOW = 'castShadow'
RECEIVE_SHADOW = 'receiveShadow'
QUAD = 'quad'

USER_DATA = 'userData'

MASK = {
    QUAD: 0,
    MATERIALS: 1,
    UVS: 3,
    NORMALS: 5,
    COLORS: 7
}


CHILDREN = 'children'

URL = 'url'
WRAP = 'wrap'
REPEAT = 'repeat'
WRAPPING = type('Wrapping', (), {
260 261 262
    'REPEAT': 'repeat',
    'CLAMP': 'clamp',
    'MIRROR': 'mirror'
R
repsac 已提交
263 264 265 266 267 268 269 270 271 272
})
ANISOTROPY = 'anisotropy'
MAG_FILTER = 'magFilter'
MIN_FILTER = 'minFilter'
MAPPING = 'mapping'

IMAGE = 'image'

NAME = 'name'
PARENT = 'parent'
273 274 275
LENGTH = 'length'
FPS = 'fps'
HIERARCHY = 'hierarchy'
R
repsac 已提交
276 277
POS = 'pos'
ROTQ = 'rotq'
278 279 280 281
ROT = 'rot'
SCL = 'scl'
TIME = 'time'
KEYS = 'keys'
R
repsac 已提交
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338

COLOR = 'color'
EMISSIVE = 'emissive'
SPECULAR = 'specular'
SPECULAR_COEF = 'specularCoef'
SHININESS = 'shininess'
SIDE = 'side'
OPACITY = 'opacity'
TRANSPARENT = 'transparent'
WIREFRAME = 'wireframe'
BLENDING = 'blending'
VERTEX_COLORS = 'vertexColors'
DEPTH_WRITE = 'depthWrite'
DEPTH_TEST = 'depthTest'

MAP = 'map'
SPECULAR_MAP = 'specularMap'
LIGHT_MAP = 'lightMap'
BUMP_MAP = 'bumpMap'
BUMP_SCALE = 'bumpScale'
NORMAL_MAP = 'normalMap'
NORMAL_SCALE = 'normalScale'

#@TODO ENV_MAP, REFLECTIVITY, REFRACTION_RATIO, COMBINE

MAP_DIFFUSE = 'mapDiffuse'
MAP_DIFFUSE_REPEAT = 'mapDiffuseRepeat'
MAP_DIFFUSE_WRAP = 'mapDiffuseWrap'
MAP_DIFFUSE_ANISOTROPY = 'mapDiffuseAnisotropy'

MAP_SPECULAR = 'mapSpecular'
MAP_SPECULAR_REPEAT = 'mapSpecularRepeat'
MAP_SPECULAR_WRAP = 'mapSpecularWrap'
MAP_SPECULAR_ANISOTROPY = 'mapSpecularAnisotropy'

MAP_LIGHT = 'mapLight'
MAP_LIGHT_REPEAT = 'mapLightRepeat'
MAP_LIGHT_WRAP = 'mapLightWrap'
MAP_LIGHT_ANISOTROPY = 'mapLightAnisotropy'

MAP_NORMAL = 'mapNormal'
MAP_NORMAL_FACTOR = 'mapNormalFactor'
MAP_NORMAL_REPEAT = 'mapNormalRepeat'
MAP_NORMAL_WRAP = 'mapNormalWrap'
MAP_NORMAL_ANISOTROPY = 'mapNormalAnisotropy'

MAP_BUMP = 'mapBump'
MAP_BUMP_REPEAT = 'mapBumpRepeat'
MAP_BUMP_WRAP = 'mapBumpWrap'
MAP_BUMP_ANISOTROPY = 'mapBumpAnisotropy'
MAP_BUMP_SCALE = 'mapBumpScale'

NORMAL_BLENDING = 0

VERTEX_COLORS_ON = 2
VERTEX_COLORS_OFF = 0

V
Vitaly Ovchinnikov 已提交
339 340
SIDE_DOUBLE = 2

R
repsac 已提交
341 342 343 344 345 346 347 348
THREE_BASIC = 'MeshBasicMaterial'
THREE_LAMBERT = 'MeshLambertMaterial'
THREE_PHONG = 'MeshPhongMaterial'

INTENSITY = 'intensity'
DISTANCE = 'distance'
ASPECT = 'aspect'
ANGLE = 'angle'
B
Ben Houston 已提交
349
DECAY = 'decayExponent'
R
repsac 已提交
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375

FOV = 'fov'
ASPECT = 'aspect'
NEAR = 'near'
FAR = 'far'

LEFT = 'left'
RIGHT = 'right'
TOP = 'top'
BOTTOM = 'bottom'

SHADING = 'shading'
COLOR_DIFFUSE = 'colorDiffuse'
COLOR_EMISSIVE = 'colorEmissive'
COLOR_SPECULAR = 'colorSpecular'
DBG_NAME = 'DbgName'
DBG_COLOR = 'DbgColor'
DBG_INDEX = 'DbgIndex'
EMIT = 'emit'

PHONG = 'phong'
LAMBERT = 'lambert'
BASIC = 'basic'

NORMAL_BLENDING = 'NormalBlending'

376 377
DBG_COLORS = (0xeeeeee, 0xee0000, 0x00ee00, 0x0000ee,
              0xeeee00, 0x00eeee, 0xee00ee)
R
repsac 已提交
378 379 380

DOUBLE_SIDED = 'doubleSided'

381
EXPORT_SETTINGS_KEY = 'threeExportSettings'