Merge branch 'master' into patch-11
commit
a5f1f55640
|
@ -76,6 +76,53 @@ using namespace Util;
|
|||
|
||||
#define CONVERT_FBX_TIME(time) static_cast<double>(time) / 46186158000LL
|
||||
|
||||
static void correctRootTransform(const aiScene *scene) {
|
||||
if (scene == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (scene->mMetaData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t UpAxis = 1, UpAxisSign = 1, FrontAxis = 2, FrontAxisSign = 1, CoordAxis = 0, CoordAxisSign = 1;
|
||||
double UnitScaleFactor = 1.0;
|
||||
for (unsigned MetadataIndex = 0; MetadataIndex < scene->mMetaData->mNumProperties; ++MetadataIndex) {
|
||||
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "UpAxis") == 0) {
|
||||
scene->mMetaData->Get<int32_t>(MetadataIndex, UpAxis);
|
||||
}
|
||||
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "UpAxisSign") == 0) {
|
||||
scene->mMetaData->Get<int32_t>(MetadataIndex, UpAxisSign);
|
||||
}
|
||||
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "FrontAxis") == 0) {
|
||||
scene->mMetaData->Get<int32_t>(MetadataIndex, FrontAxis);
|
||||
}
|
||||
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "FrontAxisSign") == 0) {
|
||||
scene->mMetaData->Get<int32_t>(MetadataIndex, FrontAxisSign);
|
||||
}
|
||||
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "CoordAxis") == 0) {
|
||||
scene->mMetaData->Get<int32_t>(MetadataIndex, CoordAxis);
|
||||
}
|
||||
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "CoordAxisSign") == 0) {
|
||||
scene->mMetaData->Get<int32_t>(MetadataIndex, CoordAxisSign);
|
||||
}
|
||||
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "UnitScaleFactor") == 0) {
|
||||
scene->mMetaData->Get<double>(MetadataIndex, UnitScaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
aiVector3D upVec, forwardVec, rightVec;
|
||||
upVec[UpAxis] = UpAxisSign * static_cast<float>(UnitScaleFactor);
|
||||
forwardVec[FrontAxis] = FrontAxisSign * static_cast<float>(UnitScaleFactor);
|
||||
rightVec[CoordAxis] = CoordAxisSign * (float)UnitScaleFactor;
|
||||
|
||||
aiMatrix4x4 mat(rightVec.x, rightVec.y, rightVec.z, 0.0f,
|
||||
upVec.x, upVec.y, upVec.z, 0.0f,
|
||||
forwardVec.x, forwardVec.y, forwardVec.z, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f);
|
||||
scene->mRootNode->mTransformation *= mat;
|
||||
}
|
||||
|
||||
FBXConverter::FBXConverter(aiScene *out, const Document &doc, bool removeEmptyBones) :
|
||||
defaultMaterialIndex(),
|
||||
mMeshes(),
|
||||
|
@ -133,6 +180,8 @@ FBXConverter::FBXConverter(aiScene *out, const Document &doc, bool removeEmptyBo
|
|||
// need not contain geometry (i.e. camera animations, raw armatures).
|
||||
if (out->mNumMeshes == 0) {
|
||||
out->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
|
||||
} else {
|
||||
correctRootTransform(mSceneOut);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
@echo off
|
||||
set "initialdir=%cd%"
|
||||
goto:main
|
||||
|
||||
:exitsucc
|
||||
cd /d "%initialdir%"
|
||||
set initialdir=
|
||||
|
||||
set MSBUILD_15="C:\Program Files (x86)\Microsoft Visual Studio\2018\Professional\MSBuild\15.0\Bin\msbuild.exe"
|
||||
set MSBUILD_14="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe"
|
||||
|
||||
if not "%VS150%"=="" set MSBUILD_15="%VS150%\MSBuild\15.0\Bin\msbuild.exe"
|
||||
|
||||
if /i %VS_VERSION%==2017 (
|
||||
set MS_BUILD_EXE=%MSBUILD_15%
|
||||
set PLATFORM_VER=v141
|
||||
) else (
|
||||
set MS_BUILD_EXE=%MSBUILD_14%
|
||||
set PLATFORM_VER=v140
|
||||
)
|
||||
|
||||
set MSBUILD=%MS_BUILD_EXE%
|
||||
|
||||
exit /b 0
|
||||
|
||||
:main
|
||||
if not defined PLATFORM set "PLATFORM=x64"
|
||||
|
||||
::my work here is done?
|
||||
|
||||
set PATH_VSWHERE=C:\Program Files (x86)\Microsoft Visual Studio\Installer\
|
||||
REM set PATH_STUDIO="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\"
|
||||
|
||||
for /f "usebackq tokens=*" %%i in (`"%PATH_VSWHERE%vswhere" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
|
||||
set InstallDir=%%i
|
||||
)
|
||||
|
||||
IF EXIST "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" set VS150=%InstallDir%\
|
||||
|
||||
set "CMAKE_GENERATOR=Visual Studio 15 2017 Win64"
|
||||
if not "%VS150%"=="" call "%VS150%\VC\Auxiliary\Build\vcvarsall.bat" %PLATFORM% && echo found VS 2o17 && set PLATFORM_VER=v141 && set VS_VERSION=2017 && goto:exitsucc
|
||||
|
||||
set "CMAKE_GENERATOR=Visual Studio 14 2015 Win64"
|
||||
if defined VS140COMNTOOLS call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o15 && set PLATFORM_VER=v140 && set VS_VERSION=2015 && goto:exitsucc
|
||||
|
||||
if defined VS130COMNTOOLS echo call ghostbusters... found lost VS version
|
||||
|
||||
set "CMAKE_GENERATOR=Visual Studio 12 2013 Win64"
|
||||
if defined VS120COMNTOOLS call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o13 && set PLATFORM_VER=v120 && set VS_VERSION=2013 && goto:exitsucc
|
||||
|
||||
set "CMAKE_GENERATOR=Visual Studio 11 2012 Win64"
|
||||
if defined VS110COMNTOOLS call "%VS110COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o12 && set PLATFORM_VER=v110 && set VS_VERSION=2012 && goto:exitsucc
|
||||
|
||||
set "CMAKE_GENERATOR=Visual Studio 10 2010 Win64"
|
||||
if defined VS100COMNTOOLS call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o1o && set PLATFORM_VER=v100 && set VS_VERSION=2010 && goto:exitsucc
|
||||
|
||||
goto:exitsucc
|
|
@ -1,18 +0,0 @@
|
|||
rem @echo off
|
||||
setlocal
|
||||
call build_env_win32.bat
|
||||
|
||||
set BUILD_CONFIG=release
|
||||
set PLATFORM_CONFIG=x64
|
||||
set MAX_CPU_CONFIG=4
|
||||
|
||||
set CONFIG_PARAMETER=/p:Configuration="%BUILD_CONFIG%"
|
||||
set PLATFORM_PARAMETER=/p:Platform="%PLATFORM_CONFIG%"
|
||||
set CPU_PARAMETER=/maxcpucount:%MAX_CPU_CONFIG%
|
||||
set PLATFORM_TOOLSET=/p:PlatformToolset=%PLATFORM_VER%
|
||||
|
||||
pushd ..\..\
|
||||
cmake CMakeLists.txt -G "Visual Studio 15 2017 Win64"
|
||||
%MSBUILD% assimp.sln %CONFIG_PARAMETER% %PLATFORM_PARAMETER% %CPU_PARAMETER% %PLATFORM_TOOLSET%
|
||||
popd
|
||||
endlocal
|
Loading…
Reference in New Issue