constants.py 7.7 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 96
FACE_MATERIALS = 'faceMaterials'
SKINNING = 'skinning'
COPY_TEXTURES = 'copyTextures'
97
TEXTURE_FOLDER = 'textureFolder'
R
repsac 已提交
98 99 100
ENABLE_PRECISION = 'enablePrecision'
PRECISION = 'precision'
DEFAULT_PRECISION = 6
R
repsac 已提交
101 102
EMBED_GEOMETRY = 'embedGeometry'
EMBED_ANIMATION = 'embedAnimation'
103
OFF = 'off'
R
repsac 已提交
104 105 106 107 108

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

CRITICAL = 'critical'
ERROR = 'error'
WARNING = 'warning'
INFO = 'info'
DEBUG = 'debug'

NONE = 'None'
MSGPACK = 'msgpack'

PACK = 'pack'

122 123 124 125
FLOAT_32 = 'Float32Array'
UINT_16 = 'Uint16Array'
UINT_32 = 'Uint32Array'

126 127
INFLUENCES_PER_VERTEX = 'influencesPerVertex'

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


FORMAT_VERSION = 4.3
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'
AREA_LIGHT = 'AreaLight'
POINT_LIGHT = 'PointLight'
SPOT_LIGHT = 'SpotLight'
HEMISPHERE_LIGHT = 'HemisphereLight'
MESH = 'Mesh'
R
rkusa 已提交
205
EMPTY = 'Empty'
R
repsac 已提交
206 207 208 209 210 211 212 213 214 215 216 217 218
SPRITE = 'Sprite'

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

UUID = 'uuid'

MATRIX = 'matrix'
POSITION = 'position'
QUATERNION = 'quaternion'
219
ROTATION = 'rotation'
R
repsac 已提交
220 221 222 223 224 225 226 227
SCALE = 'scale'

UV = 'uv'
ATTRIBUTES = 'attributes'
NORMAL = 'normal'
ITEM_SIZE = 'itemSize'
ARRAY = 'array'

228 229
FLOAT_32 = 'Float32Array'

R
repsac 已提交
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
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', (), {
    'REPEAT': 'RepeatWrapping',
    'CLAMP': 'ClampToEdgeWrapping',
    'MIRROR': 'MirroredRepeatWrapping'
})
ANISOTROPY = 'anisotropy'
MAG_FILTER = 'magFilter'
MIN_FILTER = 'minFilter'
MAPPING = 'mapping'

IMAGE = 'image'

NAME = 'name'
PARENT = 'parent'
265 266 267
LENGTH = 'length'
FPS = 'fps'
HIERARCHY = 'hierarchy'
R
repsac 已提交
268 269
POS = 'pos'
ROTQ = 'rotq'
270 271 272 273
ROT = 'rot'
SCL = 'scl'
TIME = 'time'
KEYS = 'keys'
R
repsac 已提交
274 275 276 277 278 279 280 281 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

AMBIENT = 'ambient'
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 已提交
332 333
SIDE_DOUBLE = 2

R
repsac 已提交
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
THREE_BASIC = 'MeshBasicMaterial'
THREE_LAMBERT = 'MeshLambertMaterial'
THREE_PHONG = 'MeshPhongMaterial'

INTENSITY = 'intensity'
DISTANCE = 'distance'
ASPECT = 'aspect'
ANGLE = 'angle'

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

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

SHADING = 'shading'
COLOR_DIFFUSE = 'colorDiffuse'
COLOR_AMBIENT = 'colorAmbient'
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'

369 370
DBG_COLORS = (0xeeeeee, 0xee0000, 0x00ee00, 0x0000ee,
              0xeeee00, 0x00eeee, 0xee00ee)
R
repsac 已提交
371 372 373

DOUBLE_SIDED = 'doubleSided'

374
EXPORT_SETTINGS_KEY = 'threeExportSettings'