Merge branch 'master' into rbsheth_update_hunter
commit
fa486240d5
|
@ -45,15 +45,45 @@ jobs:
|
||||||
CXX: ${{ matrix.cxx }}
|
CXX: ${{ matrix.cxx }}
|
||||||
CC: ${{ matrix.cc }}
|
CC: ${{ matrix.cc }}
|
||||||
|
|
||||||
|
- name: Cache DX SDK
|
||||||
|
id: dxcache
|
||||||
|
if: matrix.name == 'windows-msvc'
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: '${{ github.workspace }}/DX_SDK'
|
||||||
|
key: ${{ runner.os }}-DX_SDK
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-DX_SDK
|
||||||
|
|
||||||
|
- name: Download DXSetup
|
||||||
|
if: matrix.name == 'windows-msvc' && steps.dxcache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
|
||||||
|
cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK"
|
||||||
|
|
||||||
|
- name: Set Windows specific CMake arguments
|
||||||
|
if: matrix.name == 'windows-msvc'
|
||||||
|
id: windows_extra_cmake_args
|
||||||
|
run: echo "::set-output name=args::'-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1'"
|
||||||
|
|
||||||
- name: configure and build
|
- name: configure and build
|
||||||
uses: lukka/run-cmake@v2
|
uses: lukka/run-cmake@v2
|
||||||
|
env:
|
||||||
|
DXSDK_DIR: '${{ github.workspace }}/DX_SDK'
|
||||||
|
|
||||||
with:
|
with:
|
||||||
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
|
||||||
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
|
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
|
||||||
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release'
|
cmakeAppendedArgs: '-GNinja -DCMAKE_BUILD_TYPE=Release ${{ steps.windows_extra_cmake_args.outputs.args }}'
|
||||||
buildWithCMakeArgs: '-- -v'
|
buildWithCMakeArgs: '-- -v'
|
||||||
buildDirectory: '${{ github.workspace }}/build/'
|
buildDirectory: '${{ github.workspace }}/build/'
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
run: cd build/bin && ./unit
|
run: cd build/bin && ./unit
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
if: matrix.name == 'windows-msvc'
|
||||||
|
with:
|
||||||
|
name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}'
|
||||||
|
path: build/bin
|
||||||
|
|
|
@ -484,6 +484,12 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||||
needMat[idx].second += ((unsigned int)(*it).entries.size() - 1) << 1u;
|
needMat[idx].second += ((unsigned int)(*it).entries.size() - 1) << 1u;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// triangle strip
|
||||||
|
case 0x4:
|
||||||
|
needMat[idx].first += (unsigned int)(*it).entries.size() - 2;
|
||||||
|
needMat[idx].second += ((unsigned int)(*it).entries.size() - 2) * 3;
|
||||||
|
break;
|
||||||
|
|
||||||
// 0 == polygon, else unknown
|
// 0 == polygon, else unknown
|
||||||
default:
|
default:
|
||||||
if ((*it).flags & 0xf) {
|
if ((*it).flags & 0xf) {
|
||||||
|
@ -570,6 +576,64 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (type == 0x4) {
|
||||||
|
for (unsigned int i = 0; i < (unsigned int)src.entries.size() - 2; ++i) {
|
||||||
|
const Surface::SurfaceEntry &entry1 = src.entries[i];
|
||||||
|
const Surface::SurfaceEntry &entry2 = src.entries[i + 1];
|
||||||
|
const Surface::SurfaceEntry &entry3 = src.entries[i + 2];
|
||||||
|
|
||||||
|
// skip degenerate triangles
|
||||||
|
if (object.vertices[entry1.first] == object.vertices[entry2.first] ||
|
||||||
|
object.vertices[entry1.first] == object.vertices[entry3.first] ||
|
||||||
|
object.vertices[entry2.first] == object.vertices[entry3.first]) {
|
||||||
|
mesh->mNumFaces--;
|
||||||
|
mesh->mNumVertices -= 3;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
aiFace &face = *faces++;
|
||||||
|
face.mNumIndices = 3;
|
||||||
|
face.mIndices = new unsigned int[face.mNumIndices];
|
||||||
|
face.mIndices[0] = cur++;
|
||||||
|
face.mIndices[1] = cur++;
|
||||||
|
face.mIndices[2] = cur++;
|
||||||
|
if (!(i & 1)) {
|
||||||
|
*vertices++ = object.vertices[entry1.first] + object.translation;
|
||||||
|
if (uv) {
|
||||||
|
uv->x = entry1.second.x;
|
||||||
|
uv->y = entry1.second.y;
|
||||||
|
++uv;
|
||||||
|
}
|
||||||
|
*vertices++ = object.vertices[entry2.first] + object.translation;
|
||||||
|
if (uv) {
|
||||||
|
uv->x = entry2.second.x;
|
||||||
|
uv->y = entry2.second.y;
|
||||||
|
++uv;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*vertices++ = object.vertices[entry2.first] + object.translation;
|
||||||
|
if (uv) {
|
||||||
|
uv->x = entry2.second.x;
|
||||||
|
uv->y = entry2.second.y;
|
||||||
|
++uv;
|
||||||
|
}
|
||||||
|
*vertices++ = object.vertices[entry1.first] + object.translation;
|
||||||
|
if (uv) {
|
||||||
|
uv->x = entry1.second.x;
|
||||||
|
uv->y = entry1.second.y;
|
||||||
|
++uv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (static_cast<unsigned>(vertices - mesh->mVertices) >= mesh->mNumVertices) {
|
||||||
|
throw DeadlyImportError("AC3D: Invalid number of vertices");
|
||||||
|
}
|
||||||
|
*vertices++ = object.vertices[entry3.first] + object.translation;
|
||||||
|
if (uv) {
|
||||||
|
uv->x = entry3.second.x;
|
||||||
|
uv->y = entry3.second.y;
|
||||||
|
++uv;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
it2 = (*it).entries.begin();
|
it2 = (*it).entries.begin();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef GLTFASSET_H_INC
|
#ifndef GLTFASSET_H_INC
|
||||||
#define GLTFASSET_H_INC
|
#define GLTFASSET_H_INC
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
|
||||||
|
|
||||||
#include <assimp/Exceptional.h>
|
#include <assimp/Exceptional.h>
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef GLTFASSETWRITER_H_INC
|
#ifndef GLTFASSETWRITER_H_INC
|
||||||
#define GLTFASSETWRITER_H_INC
|
#define GLTFASSETWRITER_H_INC
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
|
||||||
|
|
||||||
#include "glTFAsset.h"
|
#include "glTFAsset.h"
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_GLTFEXPORTER_H_INC
|
#ifndef AI_GLTFEXPORTER_H_INC
|
||||||
#define AI_GLTFEXPORTER_H_INC
|
#define AI_GLTFEXPORTER_H_INC
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER
|
#if !defined(ASSIMP_BUILD_NO_GLTF_EXPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_EXPORTER)
|
||||||
|
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
|
||||||
|
|
||||||
#include "AssetLib/glTF/glTFImporter.h"
|
#include "AssetLib/glTF/glTFImporter.h"
|
||||||
#include "AssetLib/glTF/glTFAsset.h"
|
#include "AssetLib/glTF/glTFAsset.h"
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef GLTF2ASSET_H_INC
|
#ifndef GLTF2ASSET_H_INC
|
||||||
#define GLTF2ASSET_H_INC
|
#define GLTF2ASSET_H_INC
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
|
||||||
|
|
||||||
#include <assimp/Exceptional.h>
|
#include <assimp/Exceptional.h>
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef GLTF2ASSETWRITER_H_INC
|
#ifndef GLTF2ASSETWRITER_H_INC
|
||||||
#define GLTF2ASSETWRITER_H_INC
|
#define GLTF2ASSETWRITER_H_INC
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
|
||||||
|
|
||||||
#include "glTF2Asset.h"
|
#include "glTF2Asset.h"
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_GLTF2EXPORTER_H_INC
|
#ifndef AI_GLTF2EXPORTER_H_INC
|
||||||
#define AI_GLTF2EXPORTER_H_INC
|
#define AI_GLTF2EXPORTER_H_INC
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
|
||||||
|
|
||||||
#include <assimp/types.h>
|
#include <assimp/types.h>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
|
|
@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
|
||||||
|
|
||||||
#include "AssetLib/glTF2/glTF2Importer.h"
|
#include "AssetLib/glTF2/glTF2Importer.h"
|
||||||
#include "PostProcessing/MakeVerboseFormat.h"
|
#include "PostProcessing/MakeVerboseFormat.h"
|
||||||
|
|
|
@ -100,7 +100,6 @@ size_t DefaultIOStream::Write(const void *pvBuffer,
|
||||||
size_t pCount) {
|
size_t pCount) {
|
||||||
ai_assert(nullptr != pvBuffer);
|
ai_assert(nullptr != pvBuffer);
|
||||||
ai_assert(0 != pSize);
|
ai_assert(0 != pSize);
|
||||||
ai_assert(0 != pCount);
|
|
||||||
|
|
||||||
return (mFile ? ::fwrite(pvBuffer, pSize, pCount, mFile) : 0);
|
return (mFile ? ::fwrite(pvBuffer, pSize, pCount, mFile) : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,11 +179,14 @@ static void setupExporterArray(std::vector<Exporter::ExportFormatEntry> &exporte
|
||||||
aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices));
|
aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER
|
#if !defined(ASSIMP_BUILD_NO_GLTF_EXPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_EXPORTER)
|
||||||
exporters.push_back(Exporter::ExportFormatEntry("gltf2", "GL Transmission Format v. 2", "gltf", &ExportSceneGLTF2,
|
exporters.push_back(Exporter::ExportFormatEntry("gltf2", "GL Transmission Format v. 2", "gltf", &ExportSceneGLTF2,
|
||||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
|
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
|
||||||
exporters.push_back(Exporter::ExportFormatEntry("glb2", "GL Transmission Format v. 2 (binary)", "glb", &ExportSceneGLB2,
|
exporters.push_back(Exporter::ExportFormatEntry("glb2", "GL Transmission Format v. 2 (binary)", "glb", &ExportSceneGLB2,
|
||||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
|
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ASSIMP_BUILD_NO_GLTF_EXPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_EXPORTER)
|
||||||
exporters.push_back(Exporter::ExportFormatEntry("gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF,
|
exporters.push_back(Exporter::ExportFormatEntry("gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF,
|
||||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
|
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType));
|
||||||
exporters.push_back(Exporter::ExportFormatEntry("glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB,
|
exporters.push_back(Exporter::ExportFormatEntry("glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB,
|
||||||
|
|
|
@ -1174,7 +1174,7 @@ void Importer::GetMemoryRequirements(aiMemoryInfo& in) const {
|
||||||
|
|
||||||
// add all bone anims
|
// add all bone anims
|
||||||
for (unsigned int a = 0; a < pc->mNumChannels; ++a) {
|
for (unsigned int a = 0; a < pc->mNumChannels; ++a) {
|
||||||
const aiNodeAnim* pc2 = pc->mChannels[i];
|
const aiNodeAnim* pc2 = pc->mChannels[a];
|
||||||
in.animations += sizeof(aiNodeAnim);
|
in.animations += sizeof(aiNodeAnim);
|
||||||
in.animations += pc2->mNumPositionKeys * sizeof(aiVectorKey);
|
in.animations += pc2->mNumPositionKeys * sizeof(aiVectorKey);
|
||||||
in.animations += pc2->mNumScalingKeys * sizeof(aiVectorKey);
|
in.animations += pc2->mNumScalingKeys * sizeof(aiVectorKey);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
@ -179,8 +179,10 @@ corresponding preprocessor flag to selectively disable formats.
|
||||||
#ifndef ASSIMP_BUILD_NO_ASSBIN_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_ASSBIN_IMPORTER
|
||||||
#include "AssetLib/Assbin/AssbinLoader.h"
|
#include "AssetLib/Assbin/AssbinLoader.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
|
||||||
#include "AssetLib/glTF/glTFImporter.h"
|
#include "AssetLib/glTF/glTFImporter.h"
|
||||||
|
#endif
|
||||||
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
|
||||||
#include "AssetLib/glTF2/glTF2Importer.h"
|
#include "AssetLib/glTF2/glTF2Importer.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef ASSIMP_BUILD_NO_C4D_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_C4D_IMPORTER
|
||||||
|
@ -339,8 +341,10 @@ void GetImporterInstanceList(std::vector<BaseImporter *> &out) {
|
||||||
#if (!defined ASSIMP_BUILD_NO_ASSBIN_IMPORTER)
|
#if (!defined ASSIMP_BUILD_NO_ASSBIN_IMPORTER)
|
||||||
out.push_back(new AssbinImporter());
|
out.push_back(new AssbinImporter());
|
||||||
#endif
|
#endif
|
||||||
#if (!defined ASSIMP_BUILD_NO_GLTF_IMPORTER)
|
#if (!defined ASSIMP_BUILD_NO_GLTF_IMPORTER && !defined ASSIMP_BUILD_NO_GLTF1_IMPORTER)
|
||||||
out.push_back(new glTFImporter());
|
out.push_back(new glTFImporter());
|
||||||
|
#endif
|
||||||
|
#if (!defined ASSIMP_BUILD_NO_GLTF_IMPORTER && !defined ASSIMP_BUILD_NO_GLTF2_IMPORTER)
|
||||||
out.push_back(new glTF2Importer());
|
out.push_back(new glTF2Importer());
|
||||||
#endif
|
#endif
|
||||||
#if (!defined ASSIMP_BUILD_NO_C4D_IMPORTER)
|
#if (!defined ASSIMP_BUILD_NO_C4D_IMPORTER)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -101,6 +101,12 @@ TEST(utACImportExport, importWuson) {
|
||||||
ASSERT_NE(nullptr, scene);
|
ASSERT_NE(nullptr, scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(utACImportExport, importWusonACC) {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/Wuson.acc", aiProcess_ValidateDataStructure);
|
||||||
|
ASSERT_NE(nullptr, scene);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(utACImportExport, testFormatDetection) {
|
TEST(utACImportExport, testFormatDetection) {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/TestFormatDetection", aiProcess_ValidateDataStructure);
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/TestFormatDetection", aiProcess_ValidateDataStructure);
|
||||||
|
|
Loading…
Reference in New Issue