Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 364 vs 365 for /trunk/Source Code/Geometry/Importer/DVDConverter.cpp

Diff revisions: vs.
  @@ -32,47 +32,55 @@
32 32 };
33 33
34 34 DVDConverter::DVDConverter() : _ppsteps(0) {
35 - aiTextureMapModeTable[aiTextureMapMode_Wrap] = TEXTURE_CLAMP;
36 - aiTextureMapModeTable[aiTextureMapMode_Clamp] = TEXTURE_CLAMP_TO_EDGE;
37 - aiTextureMapModeTable[aiTextureMapMode_Decal] = TEXTURE_DECAL;
38 - aiTextureMapModeTable[aiTextureMapMode_Mirror] = TEXTURE_REPEAT;
35 + aiTextureMapModeTable[aiTextureMapMode_Wrap] = TextureWrap::TEXTURE_CLAMP;
36 + aiTextureMapModeTable[aiTextureMapMode_Clamp] =
37 + TextureWrap::TEXTURE_CLAMP_TO_EDGE;
38 + aiTextureMapModeTable[aiTextureMapMode_Decal] = TextureWrap::TEXTURE_DECAL;
39 + aiTextureMapModeTable[aiTextureMapMode_Mirror] =
40 + TextureWrap::TEXTURE_REPEAT;
39 41 aiShadingModeInternalTable[aiShadingMode_Fresnel] =
40 - Material::SHADING_COOK_TORRANCE;
42 + Material::ShadingMode::SHADING_COOK_TORRANCE;
41 43 aiShadingModeInternalTable[aiShadingMode_NoShading] =
42 - Material::SHADING_FLAT;
44 + Material::ShadingMode::SHADING_FLAT;
43 45 aiShadingModeInternalTable[aiShadingMode_CookTorrance] =
44 - Material::SHADING_COOK_TORRANCE;
46 + Material::ShadingMode::SHADING_COOK_TORRANCE;
45 47 aiShadingModeInternalTable[aiShadingMode_Minnaert] =
46 - Material::SHADING_OREN_NAYAR;
48 + Material::ShadingMode::SHADING_OREN_NAYAR;
47 49 aiShadingModeInternalTable[aiShadingMode_OrenNayar] =
48 - Material::SHADING_OREN_NAYAR;
49 - aiShadingModeInternalTable[aiShadingMode_Toon] = Material::SHADING_TOON;
50 + Material::ShadingMode::SHADING_OREN_NAYAR;
51 + aiShadingModeInternalTable[aiShadingMode_Toon] =
52 + Material::ShadingMode::SHADING_TOON;
50 53 aiShadingModeInternalTable[aiShadingMode_Blinn] =
51 - Material::SHADING_BLINN_PHONG;
52 - aiShadingModeInternalTable[aiShadingMode_Phong] = Material::SHADING_PHONG;
54 + Material::ShadingMode::SHADING_BLINN_PHONG;
55 + aiShadingModeInternalTable[aiShadingMode_Phong] =
56 + Material::ShadingMode::SHADING_PHONG;
53 57 aiShadingModeInternalTable[aiShadingMode_Gouraud] =
54 - Material::SHADING_BLINN_PHONG;
55 - aiShadingModeInternalTable[aiShadingMode_Flat] = Material::SHADING_FLAT;
58 + Material::ShadingMode::SHADING_BLINN_PHONG;
59 + aiShadingModeInternalTable[aiShadingMode_Flat] =
60 + Material::ShadingMode::SHADING_FLAT;
56 61 aiTextureOperationTable[aiTextureOp_Multiply] =
57 - Material::TextureOperation_Multiply;
58 - aiTextureOperationTable[aiTextureOp_Add] = Material::TextureOperation_Add;
62 + Material::TextureOperation::TextureOperation_Multiply;
63 + aiTextureOperationTable[aiTextureOp_Add] =
64 + Material::TextureOperation::TextureOperation_Add;
59 65 aiTextureOperationTable[aiTextureOp_Subtract] =
60 - Material::TextureOperation_Subtract;
66 + Material::TextureOperation::TextureOperation_Subtract;
61 67 aiTextureOperationTable[aiTextureOp_Divide] =
62 - Material::TextureOperation_Divide;
68 + Material::TextureOperation::TextureOperation_Divide;
63 69 aiTextureOperationTable[aiTextureOp_SmoothAdd] =
64 - Material::TextureOperation_SmoothAdd;
70 + Material::TextureOperation::TextureOperation_SmoothAdd;
65 71 aiTextureOperationTable[aiTextureOp_SignedAdd] =
66 - Material::TextureOperation_SignedAdd;
72 + Material::TextureOperation::TextureOperation_SignedAdd;
67 73 aiTextureOperationTable[aiTextureOp_SignedAdd] =
68 - Material::TextureOperation_SignedAdd;
74 + Material::TextureOperation::TextureOperation_SignedAdd;
69 75 aiTextureOperationTable[/*aiTextureOp_Replace*/ 7] =
70 - Material::TextureOperation_Replace;
76 + Material::TextureOperation::TextureOperation_Replace;
71 77
72 78 importer = MemoryManager_NEW Assimp::Importer();
73 79 }
74 80
75 - DVDConverter::~DVDConverter() { MemoryManager::DELETE(importer); }
81 + DVDConverter::~DVDConverter() {
82 + MemoryManager::DELETE(importer);
83 + }
76 84
77 85 bool DVDConverter::init() {
78 86 if (_ppsteps != 0) {
  @@ -102,7 +110,7 @@
102 110 aiProcess_Triangulate | aiProcess_GenUVCoords | aiProcess_SortByPType |
103 111 aiProcess_FindDegenerates | aiProcess_FindInvalidData | 0;
104 112
105 - if (GFX_DEVICE.getAPI() != GFXDevice::OpenGL &&
113 + if (GFX_DEVICE.getAPI() != GFXDevice::OpenGL &&
106 114 GFX_DEVICE.getAPI() != GFXDevice::OpenGLES) {
107 115 _ppsteps |= aiProcess_ConvertToLeftHanded;
108 116 }
  @@ -155,9 +163,10 @@
155 163 return nullptr;
156 164 }
157 165 start = Time::ElapsedMilliseconds(true);
158 - Mesh* tempMesh = MemoryManager_NEW Mesh(_aiScenePointer->HasAnimations()
159 - ? Object3D::OBJECT_FLAG_SKINNED
160 - : Object3D::OBJECT_FLAG_NONE);
166 + Mesh* tempMesh =
167 + MemoryManager_NEW Mesh(_aiScenePointer->HasAnimations()
168 + ? Object3D::ObjectFlag::OBJECT_FLAG_SKINNED
169 + : Object3D::ObjectFlag::OBJECT_FLAG_NONE);
161 170 tempMesh->setName(_modelName);
162 171 tempMesh->setResourceLocation(_fileLocation);
163 172
  @@ -222,7 +231,8 @@
222 231 /// instead, return nullptr and mesh and material creation for this instance
223 232 /// will be skipped.
224 233 SubMesh* DVDConverter::loadSubMeshGeometry(const aiMesh* source,
225 - Mesh* parentMesh, U16 count) {
234 + Mesh* parentMesh,
235 + U16 count) {
226 236 /// VERY IMPORTANT: default submesh, LOD0 should always be created first!!
227 237 /// an assert is added in the LODn, where n >= 1, loading code to make sure
228 238 /// the LOD0 submesh exists first
  @@ -255,7 +265,8 @@
255 265 submeshdesc.setFlag(true);
256 266 submeshdesc.setID(count);
257 267 if (skinned) {
258 - submeshdesc.setEnumValue(Object3D::OBJECT_FLAG_SKINNED);
268 + submeshdesc.setEnumValue(
269 + enum_to_uint(Object3D::ObjectFlag::OBJECT_FLAG_SKINNED));
259 270 }
260 271 tempSubMesh = CreateResource<SubMesh>(submeshdesc);
261 272 if (!tempSubMesh) {
  @@ -328,7 +339,8 @@
328 339 }
329 340 } // endfor
330 341
331 - SubMeshDVDConverterAttorney::setGeometryLimits(*tempSubMesh, importBB.getMin(), importBB.getMax());
342 + SubMeshDVDConverterAttorney::setGeometryLimits(
343 + *tempSubMesh, importBB.getMin(), importBB.getMax());
332 344
333 345 if (_aiScenePointer->HasAnimations() && skinned) {
334 346 // create animator from current scene and current submesh pointer in
  @@ -345,7 +357,7 @@
345 357 source->mTextureCoords[0][j].y);
346 358 vb->addTexCoord(texCoord);
347 359 } // endfor
348 - } // endif
360 + } // endif
349 361
350 362 U32 idxCount = 0;
351 363 U32 currentIndice = 0;
  @@ -398,7 +410,8 @@
398 410 // If we found it in the Resource Cache, return a copy of it
399 411 ResourceDescriptor materialDesc(materialName);
400 412 if (skinned) {
401 - materialDesc.setEnumValue(Object3D::OBJECT_FLAG_SKINNED);
413 + materialDesc.setEnumValue(
414 + enum_to_uint(Object3D::ObjectFlag::OBJECT_FLAG_SKINNED));
402 415 }
403 416
404 417 tempMaterial = CreateResource<Material>(materialDesc);
  @@ -471,7 +484,7 @@
471 484 tempMaterial->setOpacity(opacity);
472 485
473 486 // default shading model
474 - I32 shadingModel = Material::SHADING_PHONG;
487 + I32 shadingModel = enum_to_int(Material::ShadingMode::SHADING_PHONG);
475 488 // Load shading model
476 489 aiGetMaterialInteger(source, AI_MATKEY_SHADING_MODEL, &shadingModel);
477 490 tempMaterial->setShadingMode(aiShadingModeInternalTable[shadingModel]);
  @@ -547,8 +560,10 @@
547 560 tempMaterial->setTexture(
548 561 count == 1 ? ShaderProgram::TEXTURE_UNIT1
549 562 : ShaderProgram::TEXTURE_UNIT0,
550 - textureRes, count == 0 ? Material::TextureOperation_Replace
551 - : aiTextureOperationTable[op]);
563 + textureRes,
564 + count == 0
565 + ? Material::TextureOperation::TextureOperation_Replace
566 + : aiTextureOperationTable[op]);
552 567 } // endif
553 568
554 569 tName.Clear();
  @@ -590,9 +605,9 @@
590 605 Texture* textureRes = CreateResource<Texture>(texture);
591 606 tempMaterial->setTexture(ShaderProgram::TEXTURE_NORMALMAP,
592 607 textureRes, aiTextureOperationTable[op]);
593 - tempMaterial->setBumpMethod(Material::BUMP_NORMAL);
608 + tempMaterial->setBumpMethod(Material::BumpMethod::BUMP_NORMAL);
594 609 } // endif
595 - } // endif
610 + } // endif
596 611
597 612 result = source->GetTexture(aiTextureType_HEIGHT, 0, &tName, &mapping,
598 613 &uvInd, &blend, &op, mode);
  @@ -622,9 +637,9 @@
622 637 Texture* textureRes = CreateResource<Texture>(texture);
623 638 tempMaterial->setTexture(ShaderProgram::TEXTURE_NORMALMAP,
624 639 textureRes, aiTextureOperationTable[op]);
625 - tempMaterial->setBumpMethod(Material::BUMP_NORMAL);
640 + tempMaterial->setBumpMethod(Material::BumpMethod::BUMP_NORMAL);
626 641 } // endif
627 - } // endif
642 + } // endif
628 643 result = source->GetTexture(aiTextureType_OPACITY, 0, &tName, &mapping,
629 644 &uvInd, &blend, &op, mode);
630 645 if (result == AI_SUCCESS) {
  @@ -708,7 +723,7 @@
708 723 tempMaterial->setTexture(ShaderProgram::TEXTURE_SPECULAR,
709 724 textureRes, aiTextureOperationTable[op]);
710 725 } // endif
711 - } // endif
726 + } // endif
712 727
713 728 return tempMaterial;
714 729 }