Rollup to 'upstream/master'
commit
8c60879485
|
@ -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
|
||||||
|
|
|
@ -321,7 +321,7 @@ public:
|
||||||
struct Face : public FaceWithSmoothingGroup {
|
struct Face : public FaceWithSmoothingGroup {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER > 1920
|
||||||
#pragma warning(disable : 4315)
|
#pragma warning(disable : 4315)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -1988,6 +1988,7 @@ void FBXConverter::SetTextureProperties(aiMaterial *out_mat, const TextureMap &_
|
||||||
TrySetTextureProperties(out_mat, _textures, "ShininessExponent", aiTextureType_SHININESS, mesh);
|
TrySetTextureProperties(out_mat, _textures, "ShininessExponent", aiTextureType_SHININESS, mesh);
|
||||||
TrySetTextureProperties(out_mat, _textures, "TransparencyFactor", aiTextureType_OPACITY, mesh);
|
TrySetTextureProperties(out_mat, _textures, "TransparencyFactor", aiTextureType_OPACITY, mesh);
|
||||||
TrySetTextureProperties(out_mat, _textures, "EmissiveFactor", aiTextureType_EMISSIVE, mesh);
|
TrySetTextureProperties(out_mat, _textures, "EmissiveFactor", aiTextureType_EMISSIVE, mesh);
|
||||||
|
TrySetTextureProperties(out_mat, _textures, "ReflectionFactor", aiTextureType_METALNESS, mesh);
|
||||||
//Maya counterparts
|
//Maya counterparts
|
||||||
TrySetTextureProperties(out_mat, _textures, "Maya|DiffuseTexture", aiTextureType_DIFFUSE, mesh);
|
TrySetTextureProperties(out_mat, _textures, "Maya|DiffuseTexture", aiTextureType_DIFFUSE, mesh);
|
||||||
TrySetTextureProperties(out_mat, _textures, "Maya|NormalTexture", aiTextureType_NORMALS, mesh);
|
TrySetTextureProperties(out_mat, _textures, "Maya|NormalTexture", aiTextureType_NORMALS, mesh);
|
||||||
|
|
|
@ -400,6 +400,65 @@ void FBXExporter::WriteHeaderExtension ()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WriteGlobalSettings helpers
|
||||||
|
|
||||||
|
void WritePropInt(const aiScene* scene, FBX::Node& p, const std::string& key, int defaultValue)
|
||||||
|
{
|
||||||
|
int value;
|
||||||
|
if (scene->mMetaData->Get(key, value)) {
|
||||||
|
p.AddP70int(key, value);
|
||||||
|
} else {
|
||||||
|
p.AddP70int(key, defaultValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WritePropDouble(const aiScene* scene, FBX::Node& p, const std::string& key, double defaultValue)
|
||||||
|
{
|
||||||
|
double value;
|
||||||
|
if (scene->mMetaData->Get(key, value)) {
|
||||||
|
p.AddP70double(key, value);
|
||||||
|
} else {
|
||||||
|
// fallback lookup float instead
|
||||||
|
float floatValue;
|
||||||
|
if (scene->mMetaData->Get(key, floatValue)) {
|
||||||
|
p.AddP70double(key, (double)floatValue);
|
||||||
|
} else {
|
||||||
|
p.AddP70double(key, defaultValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WritePropEnum(const aiScene* scene, FBX::Node& p, const std::string& key, int defaultValue)
|
||||||
|
{
|
||||||
|
int value;
|
||||||
|
if (scene->mMetaData->Get(key, value)) {
|
||||||
|
p.AddP70enum(key, value);
|
||||||
|
} else {
|
||||||
|
p.AddP70enum(key, defaultValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WritePropColor(const aiScene* scene, FBX::Node& p, const std::string& key, const aiVector3D& defaultValue)
|
||||||
|
{
|
||||||
|
aiVector3D value;
|
||||||
|
if (scene->mMetaData->Get(key, value)) {
|
||||||
|
// ai_real can be float or double, cast to avoid warnings
|
||||||
|
p.AddP70color(key, (double)value.x, (double)value.y, (double)value.z);
|
||||||
|
} else {
|
||||||
|
p.AddP70color(key, (double)defaultValue.x, (double)defaultValue.y, (double)defaultValue.z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WritePropString(const aiScene* scene, FBX::Node& p, const std::string& key, const std::string& defaultValue)
|
||||||
|
{
|
||||||
|
aiString value; // MetaData doesn't hold std::string
|
||||||
|
if (scene->mMetaData->Get(key, value)) {
|
||||||
|
p.AddP70string(key, value.C_Str());
|
||||||
|
} else {
|
||||||
|
p.AddP70string(key, defaultValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FBXExporter::WriteGlobalSettings ()
|
void FBXExporter::WriteGlobalSettings ()
|
||||||
{
|
{
|
||||||
if (!binary) {
|
if (!binary) {
|
||||||
|
@ -409,26 +468,26 @@ void FBXExporter::WriteGlobalSettings ()
|
||||||
gs.AddChild("Version", int32_t(1000));
|
gs.AddChild("Version", int32_t(1000));
|
||||||
|
|
||||||
FBX::Node p("Properties70");
|
FBX::Node p("Properties70");
|
||||||
p.AddP70int("UpAxis", 1);
|
WritePropInt(mScene, p, "UpAxis", 1);
|
||||||
p.AddP70int("UpAxisSign", 1);
|
WritePropInt(mScene, p, "UpAxisSign", 1);
|
||||||
p.AddP70int("FrontAxis", 2);
|
WritePropInt(mScene, p, "FrontAxis", 2);
|
||||||
p.AddP70int("FrontAxisSign", 1);
|
WritePropInt(mScene, p, "FrontAxisSign", 1);
|
||||||
p.AddP70int("CoordAxis", 0);
|
WritePropInt(mScene, p, "CoordAxis", 0);
|
||||||
p.AddP70int("CoordAxisSign", 1);
|
WritePropInt(mScene, p, "CoordAxisSign", 1);
|
||||||
p.AddP70int("OriginalUpAxis", 1);
|
WritePropInt(mScene, p, "OriginalUpAxis", 1);
|
||||||
p.AddP70int("OriginalUpAxisSign", 1);
|
WritePropInt(mScene, p, "OriginalUpAxisSign", 1);
|
||||||
p.AddP70double("UnitScaleFactor", 1.0);
|
WritePropDouble(mScene, p, "UnitScaleFactor", 1.0);
|
||||||
p.AddP70double("OriginalUnitScaleFactor", 1.0);
|
WritePropDouble(mScene, p, "OriginalUnitScaleFactor", 1.0);
|
||||||
p.AddP70color("AmbientColor", 0.0, 0.0, 0.0);
|
WritePropColor(mScene, p, "AmbientColor", aiVector3D((ai_real)0.0, (ai_real)0.0, (ai_real)0.0));
|
||||||
p.AddP70string("DefaultCamera", "Producer Perspective");
|
WritePropString(mScene, p,"DefaultCamera", "Producer Perspective");
|
||||||
p.AddP70enum("TimeMode", 11);
|
WritePropEnum(mScene, p, "TimeMode", 11);
|
||||||
p.AddP70enum("TimeProtocol", 2);
|
WritePropEnum(mScene, p, "TimeProtocol", 2);
|
||||||
p.AddP70enum("SnapOnFrameMode", 0);
|
WritePropEnum(mScene, p, "SnapOnFrameMode", 0);
|
||||||
p.AddP70time("TimeSpanStart", 0); // TODO: animation support
|
p.AddP70time("TimeSpanStart", 0); // TODO: animation support
|
||||||
p.AddP70time("TimeSpanStop", FBX::SECOND); // TODO: animation support
|
p.AddP70time("TimeSpanStop", FBX::SECOND); // TODO: animation support
|
||||||
p.AddP70double("CustomFrameRate", -1.0);
|
WritePropDouble(mScene, p, "CustomFrameRate", -1.0);
|
||||||
p.AddP70("TimeMarker", "Compound", "", ""); // not sure what this is
|
p.AddP70("TimeMarker", "Compound", "", ""); // not sure what this is
|
||||||
p.AddP70int("CurrentTimeMarker", -1);
|
WritePropInt(mScene, p, "CurrentTimeMarker", -1);
|
||||||
gs.AddChild(p);
|
gs.AddChild(p);
|
||||||
|
|
||||||
gs.Dump(outfile, binary, 0);
|
gs.Dump(outfile, binary, 0);
|
||||||
|
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "AssetLib/Step/STEPFile.h"
|
#include "AssetLib/Step/STEPFile.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER > 1920
|
||||||
# pragma warning( disable : 4512 )
|
# pragma warning( disable : 4512 )
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,9 @@ typedef uint16_t M3D_INDEX;
|
||||||
#define M3D_BONEMAXLEVEL 8
|
#define M3D_BONEMAXLEVEL 8
|
||||||
#endif
|
#endif
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
#ifndef _inline
|
||||||
#define _inline __inline__
|
#define _inline __inline__
|
||||||
|
#endif
|
||||||
#define _pack __attribute__((packed))
|
#define _pack __attribute__((packed))
|
||||||
#define _unused __attribute__((unused))
|
#define _unused __attribute__((unused))
|
||||||
#else
|
#else
|
||||||
|
@ -99,7 +101,7 @@ typedef uint16_t M3D_INDEX;
|
||||||
#define _register
|
#define _register
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER > 1920
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning(disable : 4100 4127 4189 4505 4244 4403 4701 4703)
|
# pragma warning(disable : 4100 4127 4189 4505 4244 4403 4701 4703)
|
||||||
# if (_MSC_VER > 1800 )
|
# if (_MSC_VER > 1800 )
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace Assimp {
|
||||||
namespace MDL {
|
namespace MDL {
|
||||||
namespace HalfLife {
|
namespace HalfLife {
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER > 1920
|
||||||
# pragma warning(disable : 4706)
|
# pragma warning(disable : 4706)
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER > 1920
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning(disable : 4127 4456 4245 4512 )
|
# pragma warning(disable : 4127 4456 4245 4512 )
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
@ -727,7 +727,7 @@ struct InternGenericConvert<Maybe<T>> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER > 1920
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4127)
|
#pragma warning(disable : 4127)
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
@ -960,7 +960,7 @@ private:
|
||||||
const EXPRESS::ConversionSchema *schema;
|
const EXPRESS::ConversionSchema *schema;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER > 1920
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -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>
|
||||||
|
|
||||||
|
@ -406,6 +406,8 @@ struct Accessor : public Object {
|
||||||
void ExtractData(T *&outData);
|
void ExtractData(T *&outData);
|
||||||
|
|
||||||
void WriteData(size_t count, const void *src_buffer, size_t src_stride);
|
void WriteData(size_t count, const void *src_buffer, size_t src_stride);
|
||||||
|
void WriteSparseValues(size_t count, const void *src_data, size_t src_dataStride);
|
||||||
|
void WriteSparseIndices(size_t count, const void *src_idx, size_t src_idxStride);
|
||||||
|
|
||||||
//! Helper class to iterate the data
|
//! Helper class to iterate the data
|
||||||
class Indexer {
|
class Indexer {
|
||||||
|
@ -1066,6 +1068,7 @@ public:
|
||||||
} extensionsRequired;
|
} extensionsRequired;
|
||||||
|
|
||||||
AssetMetadata asset;
|
AssetMetadata asset;
|
||||||
|
Value* extras = nullptr;
|
||||||
|
|
||||||
// Dictionaries for each type of object
|
// Dictionaries for each type of object
|
||||||
|
|
||||||
|
|
|
@ -757,6 +757,33 @@ inline void Accessor::WriteData(size_t _count, const void *src_buffer, size_t sr
|
||||||
CopyData(_count, src, src_stride, dst, dst_stride);
|
CopyData(_count, src, src_stride, dst, dst_stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void Accessor::WriteSparseValues(size_t _count, const void *src_data, size_t src_dataStride) {
|
||||||
|
if (!sparse)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// values
|
||||||
|
uint8_t *value_buffer_ptr = sparse->values->buffer->GetPointer();
|
||||||
|
size_t value_offset = sparse->valuesByteOffset + sparse->values->byteOffset;
|
||||||
|
size_t value_dst_stride = GetNumComponents() * GetBytesPerComponent();
|
||||||
|
const uint8_t *value_src = reinterpret_cast<const uint8_t *>(src_data);
|
||||||
|
uint8_t *value_dst = reinterpret_cast<uint8_t *>(value_buffer_ptr + value_offset);
|
||||||
|
ai_assert(value_dst + _count * value_dst_stride <= value_buffer_ptr + sparse->values->buffer->byteLength);
|
||||||
|
CopyData(_count, value_src, src_dataStride, value_dst, value_dst_stride);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Accessor::WriteSparseIndices(size_t _count, const void *src_idx, size_t src_idxStride) {
|
||||||
|
if (!sparse)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// indices
|
||||||
|
uint8_t *indices_buffer_ptr = sparse->indices->buffer->GetPointer();
|
||||||
|
size_t indices_offset = sparse->indicesByteOffset + sparse->indices->byteOffset;
|
||||||
|
size_t indices_dst_stride = 1 * sizeof(unsigned short);
|
||||||
|
const uint8_t *indices_src = reinterpret_cast<const uint8_t *>(src_idx);
|
||||||
|
uint8_t *indices_dst = reinterpret_cast<uint8_t *>(indices_buffer_ptr + indices_offset);
|
||||||
|
ai_assert(indices_dst + _count * indices_dst_stride <= indices_buffer_ptr + sparse->indices->buffer->byteLength);
|
||||||
|
CopyData(_count, indices_src, src_idxStride, indices_dst, indices_dst_stride);
|
||||||
|
}
|
||||||
inline Accessor::Indexer::Indexer(Accessor &acc) :
|
inline Accessor::Indexer::Indexer(Accessor &acc) :
|
||||||
accessor(acc),
|
accessor(acc),
|
||||||
data(acc.GetPointer()),
|
data(acc.GetPointer()),
|
||||||
|
@ -1287,6 +1314,8 @@ inline void Node::Read(Value &obj, Asset &r) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not retrieve a skin here, just take a reference, to avoid infinite recursion
|
||||||
|
// Skins will be properly loaded later
|
||||||
Value *curSkin = FindUInt(obj, "skin");
|
Value *curSkin = FindUInt(obj, "skin");
|
||||||
if (nullptr != curSkin) {
|
if (nullptr != curSkin) {
|
||||||
this->skin = r.skins.Get(curSkin->GetUint());
|
this->skin = r.skins.Get(curSkin->GetUint());
|
||||||
|
@ -1584,7 +1613,6 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read skins after nodes have been loaded to avoid infinite recursion
|
|
||||||
if (Value *skinsArray = FindArray(doc, "skins")) {
|
if (Value *skinsArray = FindArray(doc, "skins")) {
|
||||||
for (unsigned int i = 0; i < skinsArray->Size(); ++i) {
|
for (unsigned int i = 0; i < skinsArray->Size(); ++i) {
|
||||||
skins.Retrieve(i);
|
skins.Retrieve(i);
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -107,21 +107,47 @@ namespace glTF2 {
|
||||||
|
|
||||||
inline void Write(Value& obj, Accessor& a, AssetWriter& w)
|
inline void Write(Value& obj, Accessor& a, AssetWriter& w)
|
||||||
{
|
{
|
||||||
obj.AddMember("bufferView", a.bufferView->index, w.mAl);
|
if (a.bufferView) {
|
||||||
obj.AddMember("byteOffset", (unsigned int)a.byteOffset, w.mAl);
|
obj.AddMember("bufferView", a.bufferView->index, w.mAl);
|
||||||
|
obj.AddMember("byteOffset", (unsigned int)a.byteOffset, w.mAl);
|
||||||
|
Value vTmpMax, vTmpMin;
|
||||||
|
if (a.componentType == ComponentType_FLOAT) {
|
||||||
|
obj.AddMember("max", MakeValue(vTmpMax, a.max, w.mAl), w.mAl);
|
||||||
|
obj.AddMember("min", MakeValue(vTmpMin, a.min, w.mAl), w.mAl);
|
||||||
|
} else {
|
||||||
|
obj.AddMember("max", MakeValueCast<int64_t>(vTmpMax, a.max, w.mAl), w.mAl);
|
||||||
|
obj.AddMember("min", MakeValueCast<int64_t>(vTmpMin, a.min, w.mAl), w.mAl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
obj.AddMember("componentType", int(a.componentType), w.mAl);
|
obj.AddMember("componentType", int(a.componentType), w.mAl);
|
||||||
obj.AddMember("count", (unsigned int)a.count, w.mAl);
|
obj.AddMember("count", (unsigned int)a.count, w.mAl);
|
||||||
obj.AddMember("type", StringRef(AttribType::ToString(a.type)), w.mAl);
|
obj.AddMember("type", StringRef(AttribType::ToString(a.type)), w.mAl);
|
||||||
|
|
||||||
Value vTmpMax, vTmpMin;
|
if (a.sparse) {
|
||||||
if (a.componentType == ComponentType_FLOAT) {
|
Value sparseValue;
|
||||||
obj.AddMember("max", MakeValue(vTmpMax, a.max, w.mAl), w.mAl);
|
sparseValue.SetObject();
|
||||||
obj.AddMember("min", MakeValue(vTmpMin, a.min, w.mAl), w.mAl);
|
|
||||||
} else {
|
//count
|
||||||
obj.AddMember("max", MakeValueCast<int64_t>(vTmpMax, a.max, w.mAl), w.mAl);
|
sparseValue.AddMember("count", (unsigned int)a.sparse->count, w.mAl);
|
||||||
obj.AddMember("min", MakeValueCast<int64_t>(vTmpMin, a.min, w.mAl), w.mAl);
|
|
||||||
}
|
//indices
|
||||||
|
Value indices;
|
||||||
|
indices.SetObject();
|
||||||
|
indices.AddMember("bufferView", a.sparse->indices->index, w.mAl);
|
||||||
|
indices.AddMember("byteOffset", (unsigned int)a.sparse->indicesByteOffset, w.mAl);
|
||||||
|
indices.AddMember("componentType", int(a.sparse->indicesType), w.mAl);
|
||||||
|
sparseValue.AddMember("indices", indices, w.mAl);
|
||||||
|
|
||||||
|
//values
|
||||||
|
Value values;
|
||||||
|
values.SetObject();
|
||||||
|
values.AddMember("bufferView", a.sparse->values->index, w.mAl);
|
||||||
|
values.AddMember("byteOffset", (unsigned int)a.sparse->valuesByteOffset, w.mAl);
|
||||||
|
sparseValue.AddMember("values", values, w.mAl);
|
||||||
|
|
||||||
|
obj.AddMember("sparse", sparseValue, w.mAl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Write(Value& obj, Animation& a, AssetWriter& w)
|
inline void Write(Value& obj, Animation& a, AssetWriter& w)
|
||||||
|
@ -616,6 +642,10 @@ namespace glTF2 {
|
||||||
if (mAsset.scene) {
|
if (mAsset.scene) {
|
||||||
mDoc.AddMember("scene", mAsset.scene->index, mAl);
|
mDoc.AddMember("scene", mAsset.scene->index, mAl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mAsset.extras) {
|
||||||
|
mDoc.AddMember("extras", *mAsset.extras, mAl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void AssetWriter::WriteFile(const char* path)
|
inline void AssetWriter::WriteFile(const char* path)
|
||||||
|
@ -709,10 +739,13 @@ namespace glTF2 {
|
||||||
// Binary chunk
|
// Binary chunk
|
||||||
//
|
//
|
||||||
|
|
||||||
|
int GLB_Chunk_count = 1;
|
||||||
uint32_t binaryChunkLength = 0;
|
uint32_t binaryChunkLength = 0;
|
||||||
if (bodyBuffer->byteLength > 0) {
|
if (bodyBuffer->byteLength > 0) {
|
||||||
binaryChunkLength = (bodyBuffer->byteLength + 3) & ~3; // Round up to next multiple of 4
|
binaryChunkLength = (bodyBuffer->byteLength + 3) & ~3; // Round up to next multiple of 4
|
||||||
//auto curPaddingLength = binaryChunkLength - bodyBuffer->byteLength;
|
|
||||||
|
auto curPaddingLength = binaryChunkLength - bodyBuffer->byteLength;
|
||||||
|
++GLB_Chunk_count;
|
||||||
|
|
||||||
GLB_Chunk binaryChunk;
|
GLB_Chunk binaryChunk;
|
||||||
binaryChunk.chunkLength = binaryChunkLength;
|
binaryChunk.chunkLength = binaryChunkLength;
|
||||||
|
@ -727,7 +760,7 @@ namespace glTF2 {
|
||||||
if (outfile->Write(bodyBuffer->GetPointer(), 1, bodyBuffer->byteLength) != bodyBuffer->byteLength) {
|
if (outfile->Write(bodyBuffer->GetPointer(), 1, bodyBuffer->byteLength) != bodyBuffer->byteLength) {
|
||||||
throw DeadlyExportError("Failed to write body data!");
|
throw DeadlyExportError("Failed to write body data!");
|
||||||
}
|
}
|
||||||
if (paddingLength && outfile->Write(&padding, 1, paddingLength) != paddingLength) {
|
if (curPaddingLength && outfile->Write(&padding, 1, paddingLength) != paddingLength) {
|
||||||
throw DeadlyExportError("Failed to write body data padding!");
|
throw DeadlyExportError("Failed to write body data padding!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -742,7 +775,7 @@ namespace glTF2 {
|
||||||
header.version = 2;
|
header.version = 2;
|
||||||
AI_SWAP4(header.version);
|
AI_SWAP4(header.version);
|
||||||
|
|
||||||
header.length = uint32_t(sizeof(GLB_Header) + 2 * sizeof(GLB_Chunk) + jsonChunkLength + binaryChunkLength);
|
header.length = uint32_t(sizeof(GLB_Header) + GLB_Chunk_count * sizeof(GLB_Chunk) + jsonChunkLength + binaryChunkLength);
|
||||||
AI_SWAP4(header.length);
|
AI_SWAP4(header.length);
|
||||||
|
|
||||||
outfile->Seek(0, aiOrigin_SET);
|
outfile->Seek(0, aiOrigin_SET);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -116,6 +116,13 @@ glTF2Exporter::glTF2Exporter(const char* filename, IOSystem* pIOSystem, const ai
|
||||||
|
|
||||||
ExportAnimations();
|
ExportAnimations();
|
||||||
|
|
||||||
|
// export extras
|
||||||
|
if(mProperties->HasPropertyCallback("extras"))
|
||||||
|
{
|
||||||
|
std::function<void*(void*)> ExportExtras = mProperties->GetPropertyCallback("extras");
|
||||||
|
mAsset->extras = (rapidjson::Value*)ExportExtras(0);
|
||||||
|
}
|
||||||
|
|
||||||
AssetWriter writer(*mAsset);
|
AssetWriter writer(*mAsset);
|
||||||
|
|
||||||
if (isBinary) {
|
if (isBinary) {
|
||||||
|
@ -214,6 +221,158 @@ inline void SetAccessorRange(ComponentType compType, Ref<Accessor> acc, void* da
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// compute the (data-dataBase), store the non-zero data items
|
||||||
|
template <typename T>
|
||||||
|
size_t NZDiff(void *data, void *dataBase, size_t count, unsigned int numCompsIn, unsigned int numCompsOut, void *&outputNZDiff, void *&outputNZIdx) {
|
||||||
|
std::vector<T> vNZDiff;
|
||||||
|
std::vector<unsigned short> vNZIdx;
|
||||||
|
size_t totalComps = count * numCompsIn;
|
||||||
|
T *bufferData_ptr = static_cast<T *>(data);
|
||||||
|
T *bufferData_end = bufferData_ptr + totalComps;
|
||||||
|
T *bufferBase_ptr = static_cast<T *>(dataBase);
|
||||||
|
|
||||||
|
// Search and set extreme values.
|
||||||
|
for (short idx = 0; bufferData_ptr < bufferData_end; idx += 1, bufferData_ptr += numCompsIn) {
|
||||||
|
bool bNonZero = false;
|
||||||
|
|
||||||
|
//for the data, check any component Non Zero
|
||||||
|
for (unsigned int j = 0; j < numCompsOut; j++) {
|
||||||
|
double valueData = bufferData_ptr[j];
|
||||||
|
double valueBase = bufferBase_ptr ? bufferBase_ptr[j] : 0;
|
||||||
|
if ((valueData - valueBase) != 0) {
|
||||||
|
bNonZero = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//all zeros, continue
|
||||||
|
if (!bNonZero)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//non zero, store the data
|
||||||
|
for (unsigned int j = 0; j < numCompsOut; j++) {
|
||||||
|
T valueData = bufferData_ptr[j];
|
||||||
|
T valueBase = bufferBase_ptr ? bufferBase_ptr[j] : 0;
|
||||||
|
vNZDiff.push_back(valueData - valueBase);
|
||||||
|
}
|
||||||
|
vNZIdx.push_back(idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
//avoid all-0, put 1 item
|
||||||
|
if (vNZDiff.size() == 0) {
|
||||||
|
for (unsigned int j = 0; j < numCompsOut; j++)
|
||||||
|
vNZDiff.push_back(0);
|
||||||
|
vNZIdx.push_back(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//process data
|
||||||
|
outputNZDiff = new T[vNZDiff.size()];
|
||||||
|
memcpy(outputNZDiff, vNZDiff.data(), vNZDiff.size() * sizeof(T));
|
||||||
|
|
||||||
|
outputNZIdx = new unsigned short[vNZIdx.size()];
|
||||||
|
memcpy(outputNZIdx, vNZIdx.data(), vNZIdx.size() * sizeof(unsigned short));
|
||||||
|
return vNZIdx.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline size_t NZDiff(ComponentType compType, void *data, void *dataBase, size_t count, unsigned int numCompsIn, unsigned int numCompsOut, void *&nzDiff, void *&nzIdx) {
|
||||||
|
switch (compType) {
|
||||||
|
case ComponentType_SHORT:
|
||||||
|
return NZDiff<short>(data, dataBase, count, numCompsIn, numCompsOut, nzDiff, nzIdx);
|
||||||
|
case ComponentType_UNSIGNED_SHORT:
|
||||||
|
return NZDiff<unsigned short>(data, dataBase, count, numCompsIn, numCompsOut, nzDiff, nzIdx);
|
||||||
|
case ComponentType_UNSIGNED_INT:
|
||||||
|
return NZDiff<unsigned int>(data, dataBase, count, numCompsIn, numCompsOut, nzDiff, nzIdx);
|
||||||
|
case ComponentType_FLOAT:
|
||||||
|
return NZDiff<float>(data, dataBase, count, numCompsIn, numCompsOut, nzDiff, nzIdx);
|
||||||
|
case ComponentType_BYTE:
|
||||||
|
return NZDiff<int8_t>(data, dataBase, count, numCompsIn, numCompsOut, nzDiff, nzIdx);
|
||||||
|
case ComponentType_UNSIGNED_BYTE:
|
||||||
|
return NZDiff<uint8_t>(data, dataBase, count, numCompsIn, numCompsOut, nzDiff, nzIdx);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Ref<Accessor> ExportDataSparse(Asset &a, std::string &meshName, Ref<Buffer> &buffer,
|
||||||
|
size_t count, void *data, AttribType::Value typeIn, AttribType::Value typeOut, ComponentType compType, BufferViewTarget target = BufferViewTarget_NONE, void *dataBase = 0) {
|
||||||
|
if (!count || !data) {
|
||||||
|
return Ref<Accessor>();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int numCompsIn = AttribType::GetNumComponents(typeIn);
|
||||||
|
unsigned int numCompsOut = AttribType::GetNumComponents(typeOut);
|
||||||
|
unsigned int bytesPerComp = ComponentTypeSize(compType);
|
||||||
|
|
||||||
|
// accessor
|
||||||
|
Ref<Accessor> acc = a.accessors.Create(a.FindUniqueID(meshName, "accessor"));
|
||||||
|
|
||||||
|
// if there is a basic data vector
|
||||||
|
if (dataBase) {
|
||||||
|
size_t base_offset = buffer->byteLength;
|
||||||
|
size_t base_padding = base_offset % bytesPerComp;
|
||||||
|
base_offset += base_padding;
|
||||||
|
size_t base_length = count * numCompsOut * bytesPerComp;
|
||||||
|
buffer->Grow(base_length + base_padding);
|
||||||
|
|
||||||
|
Ref<BufferView> bv = a.bufferViews.Create(a.FindUniqueID(meshName, "view"));
|
||||||
|
bv->buffer = buffer;
|
||||||
|
bv->byteOffset = base_offset;
|
||||||
|
bv->byteLength = base_length; //! The target that the WebGL buffer should be bound to.
|
||||||
|
bv->byteStride = 0;
|
||||||
|
bv->target = target;
|
||||||
|
acc->bufferView = bv;
|
||||||
|
acc->WriteData(count, dataBase, numCompsIn * bytesPerComp);
|
||||||
|
}
|
||||||
|
acc->byteOffset = 0;
|
||||||
|
acc->componentType = compType;
|
||||||
|
acc->count = count;
|
||||||
|
acc->type = typeOut;
|
||||||
|
|
||||||
|
if (data) {
|
||||||
|
void *nzDiff = 0, *nzIdx = 0;
|
||||||
|
size_t nzCount = NZDiff(compType, data, dataBase, count, numCompsIn, numCompsOut, nzDiff, nzIdx);
|
||||||
|
acc->sparse.reset(new Accessor::Sparse);
|
||||||
|
acc->sparse->count = nzCount;
|
||||||
|
|
||||||
|
//indices
|
||||||
|
unsigned int bytesPerIdx = sizeof(unsigned short);
|
||||||
|
size_t indices_offset = buffer->byteLength;
|
||||||
|
size_t indices_padding = indices_offset % bytesPerIdx;
|
||||||
|
indices_offset += indices_padding;
|
||||||
|
size_t indices_length = nzCount * 1 * bytesPerIdx;
|
||||||
|
buffer->Grow(indices_length + indices_padding);
|
||||||
|
|
||||||
|
Ref<BufferView> indicesBV = a.bufferViews.Create(a.FindUniqueID(meshName, "view"));
|
||||||
|
indicesBV->buffer = buffer;
|
||||||
|
indicesBV->byteOffset = indices_offset;
|
||||||
|
indicesBV->byteLength = indices_length;
|
||||||
|
indicesBV->byteStride = 0;
|
||||||
|
acc->sparse->indices = indicesBV;
|
||||||
|
acc->sparse->indicesType = ComponentType_UNSIGNED_SHORT;
|
||||||
|
acc->sparse->indicesByteOffset = 0;
|
||||||
|
acc->WriteSparseIndices(nzCount, nzIdx, 1 * bytesPerIdx);
|
||||||
|
|
||||||
|
//values
|
||||||
|
size_t values_offset = buffer->byteLength;
|
||||||
|
size_t values_padding = values_offset % bytesPerComp;
|
||||||
|
values_offset += values_padding;
|
||||||
|
size_t values_length = nzCount * numCompsOut * bytesPerComp;
|
||||||
|
buffer->Grow(values_length + values_padding);
|
||||||
|
|
||||||
|
Ref<BufferView> valuesBV = a.bufferViews.Create(a.FindUniqueID(meshName, "view"));
|
||||||
|
valuesBV->buffer = buffer;
|
||||||
|
valuesBV->byteOffset = values_offset;
|
||||||
|
valuesBV->byteLength = values_length;
|
||||||
|
valuesBV->byteStride = 0;
|
||||||
|
acc->sparse->values = valuesBV;
|
||||||
|
acc->sparse->valuesByteOffset = 0;
|
||||||
|
acc->WriteSparseValues(nzCount, nzDiff, numCompsIn * bytesPerComp);
|
||||||
|
|
||||||
|
//clear
|
||||||
|
delete[] (char*)nzDiff;
|
||||||
|
delete[] (char*)nzIdx;
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
inline Ref<Accessor> ExportData(Asset& a, std::string& meshName, Ref<Buffer>& buffer,
|
inline Ref<Accessor> ExportData(Asset& a, std::string& meshName, Ref<Buffer>& buffer,
|
||||||
size_t count, void* data, AttribType::Value typeIn, AttribType::Value typeOut, ComponentType compType, BufferViewTarget target = BufferViewTarget_NONE)
|
size_t count, void* data, AttribType::Value typeIn, AttribType::Value typeOut, ComponentType compType, BufferViewTarget target = BufferViewTarget_NONE)
|
||||||
{
|
{
|
||||||
|
@ -824,6 +983,10 @@ void glTF2Exporter::ExportMeshes()
|
||||||
|
|
||||||
/*************** Targets for blendshapes ****************/
|
/*************** Targets for blendshapes ****************/
|
||||||
if (aim->mNumAnimMeshes > 0) {
|
if (aim->mNumAnimMeshes > 0) {
|
||||||
|
bool bUseSparse = this->mProperties->HasPropertyBool("GLTF2_SPARSE_ACCESSOR_EXP") &&
|
||||||
|
this->mProperties->GetPropertyBool("GLTF2_SPARSE_ACCESSOR_EXP");
|
||||||
|
bool bIncludeNormal = this->mProperties->HasPropertyBool("GLTF2_TARGET_NORMAL_EXP") &&
|
||||||
|
this->mProperties->GetPropertyBool("GLTF2_TARGET_NORMAL_EXP");
|
||||||
bool bExportTargetNames = this->mProperties->HasPropertyBool("GLTF2_TARGETNAMES_EXP") &&
|
bool bExportTargetNames = this->mProperties->HasPropertyBool("GLTF2_TARGETNAMES_EXP") &&
|
||||||
this->mProperties->GetPropertyBool("GLTF2_TARGETNAMES_EXP");
|
this->mProperties->GetPropertyBool("GLTF2_TARGETNAMES_EXP");
|
||||||
|
|
||||||
|
@ -832,7 +995,6 @@ void glTF2Exporter::ExportMeshes()
|
||||||
aiAnimMesh *pAnimMesh = aim->mAnimMeshes[am];
|
aiAnimMesh *pAnimMesh = aim->mAnimMeshes[am];
|
||||||
if (bExportTargetNames)
|
if (bExportTargetNames)
|
||||||
m->targetNames.push_back(pAnimMesh->mName.data);
|
m->targetNames.push_back(pAnimMesh->mName.data);
|
||||||
|
|
||||||
// position
|
// position
|
||||||
if (pAnimMesh->HasPositions()) {
|
if (pAnimMesh->HasPositions()) {
|
||||||
// NOTE: in gltf it is the diff stored
|
// NOTE: in gltf it is the diff stored
|
||||||
|
@ -840,9 +1002,16 @@ void glTF2Exporter::ExportMeshes()
|
||||||
for (unsigned int vt = 0; vt < pAnimMesh->mNumVertices; ++vt) {
|
for (unsigned int vt = 0; vt < pAnimMesh->mNumVertices; ++vt) {
|
||||||
pPositionDiff[vt] = pAnimMesh->mVertices[vt] - aim->mVertices[vt];
|
pPositionDiff[vt] = pAnimMesh->mVertices[vt] - aim->mVertices[vt];
|
||||||
}
|
}
|
||||||
Ref<Accessor> vec = ExportData(*mAsset, meshId, b,
|
Ref<Accessor> vec;
|
||||||
pAnimMesh->mNumVertices, pPositionDiff,
|
if (bUseSparse) {
|
||||||
AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
vec = ExportDataSparse(*mAsset, meshId, b,
|
||||||
|
pAnimMesh->mNumVertices, pPositionDiff,
|
||||||
|
AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
||||||
|
} else {
|
||||||
|
vec = ExportData(*mAsset, meshId, b,
|
||||||
|
pAnimMesh->mNumVertices, pPositionDiff,
|
||||||
|
AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
||||||
|
}
|
||||||
if (vec) {
|
if (vec) {
|
||||||
p.targets[am].position.push_back(vec);
|
p.targets[am].position.push_back(vec);
|
||||||
}
|
}
|
||||||
|
@ -850,14 +1019,21 @@ void glTF2Exporter::ExportMeshes()
|
||||||
}
|
}
|
||||||
|
|
||||||
// normal
|
// normal
|
||||||
if (pAnimMesh->HasNormals()) {
|
if (pAnimMesh->HasNormals() && bIncludeNormal) {
|
||||||
aiVector3D *pNormalDiff = new aiVector3D[pAnimMesh->mNumVertices];
|
aiVector3D *pNormalDiff = new aiVector3D[pAnimMesh->mNumVertices];
|
||||||
for (unsigned int vt = 0; vt < pAnimMesh->mNumVertices; ++vt) {
|
for (unsigned int vt = 0; vt < pAnimMesh->mNumVertices; ++vt) {
|
||||||
pNormalDiff[vt] = pAnimMesh->mNormals[vt] - aim->mNormals[vt];
|
pNormalDiff[vt] = pAnimMesh->mNormals[vt] - aim->mNormals[vt];
|
||||||
}
|
}
|
||||||
Ref<Accessor> vec = ExportData(*mAsset, meshId, b,
|
Ref<Accessor> vec;
|
||||||
pAnimMesh->mNumVertices, pNormalDiff,
|
if (bUseSparse) {
|
||||||
AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
vec = ExportDataSparse(*mAsset, meshId, b,
|
||||||
|
pAnimMesh->mNumVertices, pNormalDiff,
|
||||||
|
AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
||||||
|
} else {
|
||||||
|
vec = ExportData(*mAsset, meshId, b,
|
||||||
|
pAnimMesh->mNumVertices, pNormalDiff,
|
||||||
|
AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
||||||
|
}
|
||||||
if (vec) {
|
if (vec) {
|
||||||
p.targets[am].normal.push_back(vec);
|
p.targets[am].normal.push_back(vec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -74,7 +74,7 @@ Here we implement only the C++ interface (Assimp::Exporter).
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER > 1920
|
||||||
# pragma warning( disable : 4800 )
|
# pragma warning( disable : 4800 )
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
@ -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,
|
||||||
|
@ -580,10 +583,23 @@ ExportProperties::ExportProperties(const ExportProperties &other)
|
||||||
: mIntProperties(other.mIntProperties)
|
: mIntProperties(other.mIntProperties)
|
||||||
, mFloatProperties(other.mFloatProperties)
|
, mFloatProperties(other.mFloatProperties)
|
||||||
, mStringProperties(other.mStringProperties)
|
, mStringProperties(other.mStringProperties)
|
||||||
, mMatrixProperties(other.mMatrixProperties) {
|
, mMatrixProperties(other.mMatrixProperties)
|
||||||
|
, mCallbackProperties(other.mCallbackProperties){
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ExportProperties::SetPropertyCallback(const char *szName, const std::function<void *(void *)> &f) {
|
||||||
|
return SetGenericProperty<std::function<void *(void *)>>(mCallbackProperties, szName, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::function<void *(void *)> ExportProperties::GetPropertyCallback(const char *szName) const {
|
||||||
|
return GetGenericProperty<std::function<void *(void *)>>(mCallbackProperties, szName, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExportProperties::HasPropertyCallback(const char *szName) const {
|
||||||
|
return HasGenericProperty<std::function<void *(void *)>>(mCallbackProperties, szName);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Set a configuration property
|
// Set a configuration property
|
||||||
bool ExportProperties::SetPropertyInteger(const char* szName, int iValue) {
|
bool ExportProperties::SetPropertyInteger(const char* szName, int iValue) {
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
void mydummy() {}
|
void mydummy() {}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER > 1920
|
||||||
#pragma warning(disable : 4709)
|
#pragma warning(disable : 4709)
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -54,6 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "cexport.h"
|
#include "cexport.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
@ -107,7 +108,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportFormatEntry() :
|
ExportFormatEntry() :
|
||||||
mExportFunction(), mEnforcePP() {
|
mExportFunction(),
|
||||||
|
mEnforcePP() {
|
||||||
mDescription.id = nullptr;
|
mDescription.id = nullptr;
|
||||||
mDescription.description = nullptr;
|
mDescription.description = nullptr;
|
||||||
mDescription.fileExtension = nullptr;
|
mDescription.fileExtension = nullptr;
|
||||||
|
@ -147,7 +149,7 @@ public:
|
||||||
* interface is the default IO handler provided by ASSIMP. The default
|
* interface is the default IO handler provided by ASSIMP. The default
|
||||||
* handler is active as long the application doesn't supply its own
|
* handler is active as long the application doesn't supply its own
|
||||||
* custom IO handler via #SetIOHandler().
|
* custom IO handler via #SetIOHandler().
|
||||||
* @return A valid IOSystem interface, never nullptr. */
|
* @return A valid IOSystem interface, never NULL. */
|
||||||
IOSystem *GetIOHandler() const;
|
IOSystem *GetIOHandler() const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
@ -286,7 +288,7 @@ public:
|
||||||
* @param pIndex Index of the export format to retrieve information
|
* @param pIndex Index of the export format to retrieve information
|
||||||
* for. Valid range is 0 to #Exporter::GetExportFormatCount
|
* for. Valid range is 0 to #Exporter::GetExportFormatCount
|
||||||
* @return A description of that specific export format.
|
* @return A description of that specific export format.
|
||||||
* nullptr if pIndex is out of range. */
|
* NULL if pIndex is out of range. */
|
||||||
const aiExportFormatDesc *GetExportFormatDescription(size_t pIndex) const;
|
const aiExportFormatDesc *GetExportFormatDescription(size_t pIndex) const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
@ -329,6 +331,7 @@ public:
|
||||||
typedef std::map<KeyType, ai_real> FloatPropertyMap;
|
typedef std::map<KeyType, ai_real> FloatPropertyMap;
|
||||||
typedef std::map<KeyType, std::string> StringPropertyMap;
|
typedef std::map<KeyType, std::string> StringPropertyMap;
|
||||||
typedef std::map<KeyType, aiMatrix4x4> MatrixPropertyMap;
|
typedef std::map<KeyType, aiMatrix4x4> MatrixPropertyMap;
|
||||||
|
typedef std::map<KeyType, std::function<void *(void *)>> CallbackPropertyMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Standard constructor
|
/** Standard constructor
|
||||||
|
@ -388,6 +391,8 @@ public:
|
||||||
*/
|
*/
|
||||||
bool SetPropertyMatrix(const char *szName, const aiMatrix4x4 &sValue);
|
bool SetPropertyMatrix(const char *szName, const aiMatrix4x4 &sValue);
|
||||||
|
|
||||||
|
bool SetPropertyCallback(const char *szName, const std::function<void *(void *)> &f);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Get a configuration property.
|
/** Get a configuration property.
|
||||||
* @param szName Name of the property. All supported properties
|
* @param szName Name of the property. All supported properties
|
||||||
|
@ -440,6 +445,8 @@ public:
|
||||||
const aiMatrix4x4 GetPropertyMatrix(const char *szName,
|
const aiMatrix4x4 GetPropertyMatrix(const char *szName,
|
||||||
const aiMatrix4x4 &sErrorReturn = aiMatrix4x4()) const;
|
const aiMatrix4x4 &sErrorReturn = aiMatrix4x4()) const;
|
||||||
|
|
||||||
|
std::function<void *(void *)> GetPropertyCallback(const char* szName) const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Determine a integer configuration property has been set.
|
/** Determine a integer configuration property has been set.
|
||||||
* @see HasPropertyInteger()
|
* @see HasPropertyInteger()
|
||||||
|
@ -466,7 +473,8 @@ public:
|
||||||
*/
|
*/
|
||||||
bool HasPropertyMatrix(const char *szName) const;
|
bool HasPropertyMatrix(const char *szName) const;
|
||||||
|
|
||||||
protected:
|
bool HasPropertyCallback(const char *szName) const;
|
||||||
|
|
||||||
/** List of integer properties */
|
/** List of integer properties */
|
||||||
IntPropertyMap mIntProperties;
|
IntPropertyMap mIntProperties;
|
||||||
|
|
||||||
|
@ -478,6 +486,8 @@ protected:
|
||||||
|
|
||||||
/** List of Matrix properties */
|
/** List of Matrix properties */
|
||||||
MatrixPropertyMap mMatrixProperties;
|
MatrixPropertyMap mMatrixProperties;
|
||||||
|
|
||||||
|
CallbackPropertyMap mCallbackProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------
|
||||||
|
|
|
@ -278,7 +278,7 @@ void do_motion (void)
|
||||||
static int frames = 0;
|
static int frames = 0;
|
||||||
|
|
||||||
int time = glutGet(GLUT_ELAPSED_TIME);
|
int time = glutGet(GLUT_ELAPSED_TIME);
|
||||||
angle += static_cast<float>((time-prev_time)*0.01);
|
angle += (float)((time-prev_time)*0.01);
|
||||||
prev_time = time;
|
prev_time = time;
|
||||||
|
|
||||||
frames += 1;
|
frames += 1;
|
||||||
|
@ -376,7 +376,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
// Check and validate the specified model file extension.
|
// Check and validate the specified model file extension.
|
||||||
model_file = argv[1];
|
model_file = argv[1];
|
||||||
const char* extension = strchr(model_file, '.');
|
const char* extension = strrchr(model_file, '.');
|
||||||
if (!extension) {
|
if (!extension) {
|
||||||
print_error("Please provide a file with a valid extension.");
|
print_error("Please provide a file with a valid extension.");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
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