From 105b2bdeaf554c9f711c8a1a55ebb625f96a4dd7 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lortie Date: Sat, 4 Apr 2020 15:37:50 -0400 Subject: [PATCH 01/14] Replaced NULL with nullptr for pointers in sample SimpleTexturedDirectx11. --- .../SimpleTexturedDirectx11/ModelLoader.cpp | 2 +- .../SimpleTexturedDirectx11/main.cpp | 38 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.cpp b/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.cpp index c8f86bbec..733d3d620 100644 --- a/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.cpp +++ b/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/ModelLoader.cpp @@ -22,7 +22,7 @@ bool ModelLoader::Load(HWND hwnd, ID3D11Device * dev, ID3D11DeviceContext * devc aiProcess_Triangulate | aiProcess_ConvertToLeftHanded); - if (pScene == NULL) + if (pScene == nullptr) return false; this->directory_ = filename.substr(0, filename.find_last_of("/\\")); diff --git a/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/main.cpp b/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/main.cpp index 1ef4a401f..90338105e 100644 --- a/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/main.cpp +++ b/samples/SimpleTexturedDirectx11/SimpleTexturedDirectx11/main.cpp @@ -126,7 +126,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, int argc; LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); if (!argv) { - MessageBox(NULL, + MessageBox(nullptr, TEXT("An error occured while reading command line arguments."), TEXT("Error!"), MB_ICONERROR | MB_OK); @@ -143,7 +143,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, // Ensure that a model file has been specified. if (argc < 2) { - MessageBox(NULL, + MessageBox(nullptr, TEXT("No model file specified. The program will now close."), TEXT("Error!"), MB_ICONERROR | MB_OK); @@ -165,16 +165,16 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; + wc.hIcon = LoadIcon(nullptr, IDI_APPLICATION); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); + wc.hbrBackground = nullptr; + wc.lpszMenuName = nullptr; wc.lpszClassName = g_szClassName; - wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); + wc.hIconSm = LoadIcon(nullptr, IDI_APPLICATION); if (!RegisterClassEx(&wc)) { - MessageBox(NULL, "Window Registration Failed!", "Error!", + MessageBox(nullptr, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } @@ -188,12 +188,12 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, " Simple Textured Directx11 Sample ", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, wr.right - wr.left, wr.bottom - wr.top, - NULL, NULL, hInstance, NULL + nullptr, nullptr, hInstance, nullptr ); - if (g_hwnd == NULL) + if (g_hwnd == nullptr) { - MessageBox(NULL, "Window Creation Failed!", "Error!", + MessageBox(nullptr, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } @@ -210,7 +210,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, while (true) { - if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); @@ -372,7 +372,7 @@ void InitD3D(HINSTANCE /*hinstance*/, HWND hWnd) ID3D11Texture2D *pBackBuffer; swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); - dev->CreateRenderTargetView(pBackBuffer, NULL, &backbuffer); + dev->CreateRenderTargetView(pBackBuffer, nullptr, &backbuffer); pBackBuffer->Release(); D3D11_TEXTURE2D_DESC descDepth; @@ -440,7 +440,7 @@ void InitD3D(HINSTANCE /*hinstance*/, HWND hWnd) void CleanD3D(void) { if (swapchain) - swapchain->SetFullscreenState(FALSE, NULL); + swapchain->SetFullscreenState(FALSE, nullptr); if (ourModel) { ourModel->Close(); @@ -513,8 +513,8 @@ void InitPipeline() if(FAILED(CompileShaderFromFile(SHADER_PATH PIXEL_SHADER_FILE, 0, "main", "ps_4_0", &PS))) Throwanerror(UTFConverter(L"Failed to compile shader from file " PIXEL_SHADER_FILE).c_str()); - dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS); - dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS); + dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), nullptr, &pVS); + dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), nullptr, &pPS); D3D11_INPUT_ELEMENT_DESC ied[] = { @@ -576,16 +576,16 @@ HRESULT CompileShaderFromFile(LPCWSTR pFileName, const D3D_SHADER_MACRO* pDefine compileFlags |= D3DCOMPILE_DEBUG; #endif - ID3DBlob* pErrorBlob = NULL; + ID3DBlob* pErrorBlob = nullptr; HRESULT result = D3DCompileFromFile(pFileName, pDefines, D3D_COMPILE_STANDARD_FILE_INCLUDE, pEntryPoint, pShaderModel, compileFlags, 0, ppBytecodeBlob, &pErrorBlob); if (FAILED(result)) { - if (pErrorBlob != NULL) + if (pErrorBlob != nullptr) OutputDebugStringA((LPCSTR)pErrorBlob->GetBufferPointer()); } - if (pErrorBlob != NULL) + if (pErrorBlob != nullptr) pErrorBlob->Release(); return result; From 69f8d47941b888097e4d75bc9bf42d794bf052e5 Mon Sep 17 00:00:00 2001 From: Timur Umayev Date: Wed, 15 Apr 2020 00:31:27 +0100 Subject: [PATCH 02/14] glTF2 support targetNames --- code/glTF2/glTF2Asset.h | 1 + code/glTF2/glTF2Asset.inl | 12 ++++++++++++ code/glTF2/glTF2Importer.cpp | 3 +++ 3 files changed, 16 insertions(+) diff --git a/code/glTF2/glTF2Asset.h b/code/glTF2/glTF2Asset.h index c27522df3..9002750a9 100644 --- a/code/glTF2/glTF2Asset.h +++ b/code/glTF2/glTF2Asset.h @@ -720,6 +720,7 @@ struct Mesh : public Object { std::vector primitives; std::vector weights; + std::vector targetNames; Mesh() {} diff --git a/code/glTF2/glTF2Asset.inl b/code/glTF2/glTF2Asset.inl index a41e62e5c..e73dc1e81 100644 --- a/code/glTF2/glTF2Asset.inl +++ b/code/glTF2/glTF2Asset.inl @@ -1026,6 +1026,18 @@ inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) { } } } + + if (Value* extras = FindObject(pJSON_Object, "extras")) { + if (Value* curTargetNames = FindArray(*extras, "targetNames")) { + this->targetNames.resize(curTargetNames->Size()); + for (unsigned int i = 0; i < curTargetNames->Size(); ++i) { + Value& targetNameValue = (*curTargetNames)[i]; + if (targetNameValue.IsString()) { + this->targetNames[i] = targetNameValue.GetString(); + } + } + } + } } inline void Camera::Read(Value &obj, Asset & /*r*/) { diff --git a/code/glTF2/glTF2Importer.cpp b/code/glTF2/glTF2Importer.cpp index caff630dc..87f170e31 100644 --- a/code/glTF2/glTF2Importer.cpp +++ b/code/glTF2/glTF2Importer.cpp @@ -472,6 +472,9 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) { if (mesh.weights.size() > i) { aiAnimMesh.mWeight = mesh.weights[i]; } + if (mesh.targetNames.size() > i) { + aiAnimMesh.mName = mesh.targetNames[i]; + } } } From 379d59bcbd831ad07fcafcf5515bc7b0fee8640f Mon Sep 17 00:00:00 2001 From: Robikz Date: Thu, 16 Apr 2020 15:56:57 +0200 Subject: [PATCH 03/14] Erase the remaining _INSTALL_PREFIX and LIBSUFFIX in CMake files These seem to have survived from the migration to GNUInstallDirs in 9fb81c3be6dc30139ea32c92046c9794dca0e73e _INSTALL_PREFIX was not set anywhere and resolved to empty value, which in turn caused some paths in the installed lib config CMake files to start from '/', effectively causing the failure of the "do the installed files exist" checks. After complete replacement of all uses of the _INSTALL_PREFIX with GNUInstallDirs equivalents, the LIBSUFFIX variable has become unused and can be removed too. --- assimpTargets-debug.cmake.in | 16 ++++------------ assimpTargets-release.cmake.in | 18 +++++------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/assimpTargets-debug.cmake.in b/assimpTargets-debug.cmake.in index c067f0c48..de6459eaf 100644 --- a/assimpTargets-debug.cmake.in +++ b/assimpTargets-debug.cmake.in @@ -9,12 +9,6 @@ set(ASSIMP_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) -if ("${LIB64}" STREQUAL "TRUE") - set(LIBSUFFIX 64) -else() - set(LIBSUFFIX "") -endif() - if(MSVC) if(MSVC_TOOLSET_VERSION) set(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}") @@ -43,8 +37,6 @@ if(MSVC) endif() set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" ) - file(TO_NATIVE_PATH "${_IMPORT_PREFIX}" _IMPORT_PREFIX) - if(ASSIMP_BUILD_SHARED_LIBS) set(sharedLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@") set(importLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_IMPORT_LIBRARY_SUFFIX@") @@ -83,17 +75,17 @@ else() endif() set_target_properties(assimp::assimp PROPERTIES IMPORTED_SONAME_DEBUG "${sharedLibraryName}" - IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib${LIBSUFFIX}/${sharedLibraryName}" + IMPORTED_LOCATION_DEBUG "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}" ) list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib${LIBSUFFIX}/${sharedLibraryName}" ) + list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}" ) else() set(staticLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@") set_target_properties(assimp::assimp PROPERTIES - IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib${LIBSUFFIX}/${staticLibraryName}" + IMPORTED_LOCATION_DEBUG "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" ) list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib${LIBSUFFIX}/${staticLibraryName}" ) + list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" ) endif() endif() diff --git a/assimpTargets-release.cmake.in b/assimpTargets-release.cmake.in index 112c343e9..6a5bafcf7 100644 --- a/assimpTargets-release.cmake.in +++ b/assimpTargets-release.cmake.in @@ -9,12 +9,6 @@ set(ASSIMP_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) -if ("${LIB64}" STREQUAL "TRUE") - set(LIBSUFFIX 64) -else() - set(LIBSUFFIX "") -endif() - if(MSVC) if(MSVC_TOOLSET_VERSION) set(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}") @@ -42,8 +36,6 @@ if(MSVC) endif() endif() set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" ) - - file(TO_NATIVE_PATH "${_IMPORT_PREFIX}" _IMPORT_PREFIX) if(ASSIMP_BUILD_SHARED_LIBS) set(sharedLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@") @@ -64,7 +56,7 @@ if(MSVC) # Import target "assimp::assimp" for configuration "Release" set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_target_properties(assimp::assimp PROPERTIES - IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${staticLibraryName}" + IMPORTED_LOCATION_RELEASE "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" ) list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}") @@ -83,17 +75,17 @@ else() endif() set_target_properties(assimp::assimp PROPERTIES IMPORTED_SONAME_RELEASE "${sharedLibraryName}" - IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib${LIBSUFFIX}/${sharedLibraryName}" + IMPORTED_LOCATION_RELEASE "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}" ) list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib${LIBSUFFIX}/${sharedLibraryName}" ) + list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}" ) else() set(staticLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_STATIC_LIBRARY_SUFFIX@") set_target_properties(assimp::assimp PROPERTIES - IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib${LIBSUFFIX}/${staticLibraryName}" + IMPORTED_LOCATION_RELEASE "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" ) list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib${LIBSUFFIX}/${staticLibraryName}" ) + list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" ) endif() endif() From 3154cec79cb3c53d3bd491bad2243a8d9646cc36 Mon Sep 17 00:00:00 2001 From: Hehongyuanlove <51571751+Hehongyuanlove@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:31:07 +0800 Subject: [PATCH 04/14] Rgba2Hex add --- include/assimp/StringUtils.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/assimp/StringUtils.h b/include/assimp/StringUtils.h index 894eada60..a22876896 100644 --- a/include/assimp/StringUtils.h +++ b/include/assimp/StringUtils.h @@ -145,4 +145,22 @@ std::string DecimalToHexa( T toConvert ) { return result; } +/// @fn Rgba2Hex +/// @brief translate RGBA to String +/// @param r aiColor.r +/// @param g aiColor.g +/// @param b aiColor.b +/// @param a aiColor.a +/// @param with_head # +/// @return The hexadecimal string, is empty in case of an error. +AI_FORCE_INLINE +std::string Rgba2Hex(int r, int g, int b, int a, bool with_head) +{ + std::stringstream ss; + if (with_head) + ss << "#"; + ss << std::hex << (r << 24 | g << 16 | b << 8 | a); + return ss.str(); +} + #endif // INCLUDED_AI_STRINGUTILS_H From 3bbc8e76bda5fa144da63db80774a0f2a7681db3 Mon Sep 17 00:00:00 2001 From: Hehongyuanlove <51571751+Hehongyuanlove@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:34:05 +0800 Subject: [PATCH 05/14] Rgba2Hex to repair rgba(1,1,1,1) --- code/3MF/D3MFExporter.cpp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/code/3MF/D3MFExporter.cpp b/code/3MF/D3MFExporter.cpp index 092b947e9..b9172f63e 100644 --- a/code/3MF/D3MFExporter.cpp +++ b/code/3MF/D3MFExporter.cpp @@ -254,16 +254,28 @@ void D3MFExporter::writeBaseMaterials() { if ( mat->Get( AI_MATKEY_COLOR_DIFFUSE, color ) == aiReturn_SUCCESS ) { hexDiffuseColor.clear(); tmp.clear(); - hexDiffuseColor = "#"; - - tmp = DecimalToHexa( (ai_real) color.r ); - hexDiffuseColor += tmp; - tmp = DecimalToHexa((ai_real)color.g); - hexDiffuseColor += tmp; - tmp = DecimalToHexa((ai_real)color.b); - hexDiffuseColor += tmp; - tmp = DecimalToHexa((ai_real)color.a); - hexDiffuseColor += tmp; + // rgbs % + if(color.r <= 1 && color.g <= 1 && color.b <= 1 && color.a <= 1){ + + hexDiffuseColor = Rgba2Hex( + ((ai_real)color.r)*255, + ((ai_real)color.g)*255, + ((ai_real)color.b)*255, + ((ai_real)color.a)*255, + true + ); + + }else{ + hexDiffuseColor = "#"; + tmp = DecimalToHexa( (ai_real) color.r ); + hexDiffuseColor += tmp; + tmp = DecimalToHexa((ai_real)color.g); + hexDiffuseColor += tmp; + tmp = DecimalToHexa((ai_real)color.b); + hexDiffuseColor += tmp; + tmp = DecimalToHexa((ai_real)color.a); + hexDiffuseColor += tmp; + } } else { hexDiffuseColor = "#FFFFFFFF"; } From e9a72a505390ae76cc8506e575e6b8ffad295be1 Mon Sep 17 00:00:00 2001 From: Hehongyuanlove <51571751+Hehongyuanlove@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:38:07 +0800 Subject: [PATCH 06/14] repair formate 3MF --- code/3MF/D3MFExporter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/3MF/D3MFExporter.cpp b/code/3MF/D3MFExporter.cpp index b9172f63e..725992207 100644 --- a/code/3MF/D3MFExporter.cpp +++ b/code/3MF/D3MFExporter.cpp @@ -181,7 +181,7 @@ bool D3MFExporter::export3DModel() { writeHeader(); mModelOutput << "<" << XmlTag::model << " " << XmlTag::model_unit << "=\"millimeter\"" - << "xmlns=\"http://schemas.microsoft.com/3dmanufacturing/core/2015/02\">" + << " xmlns=\"http://schemas.microsoft.com/3dmanufacturing/core/2015/02\">" << std::endl; mModelOutput << "<" << XmlTag::resources << ">"; mModelOutput << std::endl; @@ -212,7 +212,7 @@ bool D3MFExporter::export3DModel() { } void D3MFExporter::writeHeader() { - mModelOutput << ""; + mModelOutput << ""; mModelOutput << std::endl; } @@ -296,7 +296,7 @@ void D3MFExporter::writeObjects() { if ( nullptr == currentNode ) { continue; } - mModelOutput << "<" << XmlTag::object << " id=\"" << currentNode->mName.C_Str() << "\" type=\"model\">"; + mModelOutput << "<" << XmlTag::object << " id=\"" << i + 2 << "\" type=\"model\">"; mModelOutput << std::endl; for ( unsigned int j = 0; j < currentNode->mNumMeshes; ++j ) { aiMesh *currentMesh = mScene->mMeshes[ currentNode->mMeshes[ j ] ]; @@ -360,7 +360,7 @@ void D3MFExporter::writeBuild() { mModelOutput << "<" << XmlTag::build << ">" << std::endl; for ( size_t i = 0; i < mBuildItems.size(); ++i ) { - mModelOutput << "<" << XmlTag::item << " objectid=\"" << i + 1 << "\"/>"; + mModelOutput << "<" << XmlTag::item << " objectid=\"" << i + 2 << "\"/>"; mModelOutput << std::endl; } mModelOutput << ""; From cc3760aff1bad61183bf5412ab1f4fe0d9b8e8e2 Mon Sep 17 00:00:00 2001 From: Hehongyuanlove <51571751+Hehongyuanlove@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:50:49 +0800 Subject: [PATCH 07/14] Update StringUtils.h --- include/assimp/StringUtils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/assimp/StringUtils.h b/include/assimp/StringUtils.h index a22876896..ccded24bf 100644 --- a/include/assimp/StringUtils.h +++ b/include/assimp/StringUtils.h @@ -154,7 +154,7 @@ std::string DecimalToHexa( T toConvert ) { /// @param with_head # /// @return The hexadecimal string, is empty in case of an error. AI_FORCE_INLINE -std::string Rgba2Hex(int r, int g, int b, int a, bool with_head) +std::string Rgba2Hex(floatr, float g, float b, float a, bool with_head) { std::stringstream ss; if (with_head) From 59e32a5ad97a24a0bf79140d260c8e1e63599194 Mon Sep 17 00:00:00 2001 From: Hehongyuanlove <51571751+Hehongyuanlove@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:51:18 +0800 Subject: [PATCH 08/14] Update StringUtils.h --- include/assimp/StringUtils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/assimp/StringUtils.h b/include/assimp/StringUtils.h index ccded24bf..b057b1a9d 100644 --- a/include/assimp/StringUtils.h +++ b/include/assimp/StringUtils.h @@ -154,7 +154,7 @@ std::string DecimalToHexa( T toConvert ) { /// @param with_head # /// @return The hexadecimal string, is empty in case of an error. AI_FORCE_INLINE -std::string Rgba2Hex(floatr, float g, float b, float a, bool with_head) +std::string Rgba2Hex(float r, float g, float b, float a, bool with_head) { std::stringstream ss; if (with_head) From f80bdc5b713f3b9546df10aaedd9025020c75c7b Mon Sep 17 00:00:00 2001 From: Hehongyuanlove <51571751+Hehongyuanlove@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:57:33 +0800 Subject: [PATCH 09/14] Update StringUtils.h --- include/assimp/StringUtils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/assimp/StringUtils.h b/include/assimp/StringUtils.h index b057b1a9d..a22876896 100644 --- a/include/assimp/StringUtils.h +++ b/include/assimp/StringUtils.h @@ -154,7 +154,7 @@ std::string DecimalToHexa( T toConvert ) { /// @param with_head # /// @return The hexadecimal string, is empty in case of an error. AI_FORCE_INLINE -std::string Rgba2Hex(float r, float g, float b, float a, bool with_head) +std::string Rgba2Hex(int r, int g, int b, int a, bool with_head) { std::stringstream ss; if (with_head) From 9c52fd763323586ecff1713e6b341b996bbe8b5d Mon Sep 17 00:00:00 2001 From: Hehongyuanlove <51571751+Hehongyuanlove@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:58:41 +0800 Subject: [PATCH 10/14] Update D3MFExporter.cpp --- code/3MF/D3MFExporter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/3MF/D3MFExporter.cpp b/code/3MF/D3MFExporter.cpp index 725992207..83036b236 100644 --- a/code/3MF/D3MFExporter.cpp +++ b/code/3MF/D3MFExporter.cpp @@ -258,10 +258,10 @@ void D3MFExporter::writeBaseMaterials() { if(color.r <= 1 && color.g <= 1 && color.b <= 1 && color.a <= 1){ hexDiffuseColor = Rgba2Hex( - ((ai_real)color.r)*255, - ((ai_real)color.g)*255, - ((ai_real)color.b)*255, - ((ai_real)color.a)*255, + (int)((ai_real)color.r)*255, + (int)((ai_real)color.g)*255, + (int)((ai_real)color.b)*255, + (int)((ai_real)color.a)*255, true ); From e299f71cfe6620373c52fba27b1a10d76d3481b2 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 17 Apr 2020 16:16:28 +0200 Subject: [PATCH 11/14] Adapt the formatting --- include/assimp/StringUtils.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/assimp/StringUtils.h b/include/assimp/StringUtils.h index a22876896..7e1cb4ce0 100644 --- a/include/assimp/StringUtils.h +++ b/include/assimp/StringUtils.h @@ -145,7 +145,6 @@ std::string DecimalToHexa( T toConvert ) { return result; } -/// @fn Rgba2Hex /// @brief translate RGBA to String /// @param r aiColor.r /// @param g aiColor.g @@ -153,14 +152,14 @@ std::string DecimalToHexa( T toConvert ) { /// @param a aiColor.a /// @param with_head # /// @return The hexadecimal string, is empty in case of an error. -AI_FORCE_INLINE -std::string Rgba2Hex(int r, int g, int b, int a, bool with_head) -{ +AI_FORCE_INLINE std::string Rgba2Hex(int r, int g, int b, int a, bool with_head) { std::stringstream ss; - if (with_head) + if (with_head) { ss << "#"; + } ss << std::hex << (r << 24 | g << 16 | b << 8 | a); - return ss.str(); + + return ss.str(); } #endif // INCLUDED_AI_STRINGUTILS_H From f71b332ed142c4c009ec871df95533b36ecae6d2 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 19 Apr 2020 21:14:47 +0200 Subject: [PATCH 12/14] Update glTF2Asset.inl fix VS-compiler warning. --- code/glTF2/glTF2Asset.inl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/glTF2/glTF2Asset.inl b/code/glTF2/glTF2Asset.inl index 187ed39f4..ed23b388a 100644 --- a/code/glTF2/glTF2Asset.inl +++ b/code/glTF2/glTF2Asset.inl @@ -1035,7 +1035,8 @@ inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) { } } - if (Value* extras = FindObject(pJSON_Object, "extras")) { + Value *extras = FindObject(pJSON_Object, "extras"); + if (nullptr != extras ) { if (Value* curTargetNames = FindArray(*extras, "targetNames")) { this->targetNames.resize(curTargetNames->Size()); for (unsigned int i = 0; i < curTargetNames->Size(); ++i) { From 435f898ffaf9920689171747a6e275a7afe7f00c Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 21 Apr 2020 16:06:52 +0200 Subject: [PATCH 13/14] Update to 5.0.1 --- packaging/windows-innosetup/script_x64.iss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/windows-innosetup/script_x64.iss b/packaging/windows-innosetup/script_x64.iss index 4d1b67cd0..7b49eba63 100644 --- a/packaging/windows-innosetup/script_x64.iss +++ b/packaging/windows-innosetup/script_x64.iss @@ -2,7 +2,7 @@ [Setup] AppName=Open Asset Import Library - SDK -AppVerName=Open Asset Import Library - SDK (v5.0.0) +AppVerName=Open Asset Import Library - SDK (v5.0.1) DefaultDirName={pf}\Assimp DefaultGroupName=Assimp UninstallDisplayIcon={app}\bin\x64\assimp.exe @@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico WizardImageFile=compiler:WizModernImage-IS.BMP WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP LicenseFile=License.rtf -OutputBaseFileName=assimp-sdk-5.0.0-setup -VersionInfoVersion=5.0.0.0 -VersionInfoTextVersion=5.0.0 +OutputBaseFileName=assimp-sdk-5.0.1-setup +VersionInfoVersion=5.0.1.0 +VersionInfoTextVersion=5.0.1 VersionInfoCompany=Assimp Development Team ArchitecturesInstallIn64BitMode=x64 From 32de8737b74321c67cc581efc2d591311abdcb5a Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 21 Apr 2020 16:07:58 +0200 Subject: [PATCH 14/14] Update to 5.0.1 --- packaging/windows-innosetup/script_x86.iss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/windows-innosetup/script_x86.iss b/packaging/windows-innosetup/script_x86.iss index d22d23b64..e8f591bbe 100644 --- a/packaging/windows-innosetup/script_x86.iss +++ b/packaging/windows-innosetup/script_x86.iss @@ -2,7 +2,7 @@ [Setup] AppName=Open Asset Import Library - SDK -AppVerName=Open Asset Import Library - SDK (v5.0.0) +AppVerName=Open Asset Import Library - SDK (v5.0.1) DefaultDirName={pf}\Assimp DefaultGroupName=Assimp UninstallDisplayIcon={app}\bin\x86\assimp.exe @@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico WizardImageFile=compiler:WizModernImage-IS.BMP WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP LicenseFile=License.rtf -OutputBaseFileName=assimp-sdk-5.0.0-setup -VersionInfoVersion=4.1.0.0 -VersionInfoTextVersion=4.1.0 +OutputBaseFileName=assimp-sdk-5.0.1-setup +VersionInfoVersion=5.0.1.0 +VersionInfoTextVersion=5.0.1 VersionInfoCompany=Assimp Development Team ;ArchitecturesInstallIn64BitMode=x64