Merge branch 'master' into feature/join_vertices_processor_kill_unused_vertices
commit
a5f95f993c
|
@ -87,3 +87,9 @@ lib64/assimp-vc120-mt.exp
|
||||||
xcuserdata
|
xcuserdata
|
||||||
|
|
||||||
cmake-build-debug
|
cmake-build-debug
|
||||||
|
install_manifest.txt
|
||||||
|
tools/assimp_qt_viewer/moc_glview.cpp
|
||||||
|
tools/assimp_qt_viewer/moc_glview.cpp_parameters
|
||||||
|
tools/assimp_qt_viewer/moc_mainwindow.cpp
|
||||||
|
tools/assimp_qt_viewer/moc_mainwindow.cpp_parameters
|
||||||
|
tools/assimp_qt_viewer/ui_mainwindow.h
|
||||||
|
|
|
@ -39,10 +39,12 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||||
PROJECT( Assimp )
|
PROJECT( Assimp )
|
||||||
|
|
||||||
# All supported options ###############################################
|
# All supported options ###############################################
|
||||||
|
|
||||||
OPTION( BUILD_SHARED_LIBS
|
OPTION( BUILD_SHARED_LIBS
|
||||||
"Build package with shared libraries."
|
"Build package with shared libraries."
|
||||||
ON
|
ON
|
||||||
)
|
)
|
||||||
|
|
||||||
OPTION( BUILD_FRAMEWORK
|
OPTION( BUILD_FRAMEWORK
|
||||||
"Build package as Mac OS X Framework bundle."
|
"Build package as Mac OS X Framework bundle."
|
||||||
OFF
|
OFF
|
||||||
|
@ -104,6 +106,12 @@ OPTION ( BUILD_DOCS
|
||||||
OFF
|
OFF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IF (IOS)
|
||||||
|
IF (NOT CMAKE_BUILD_TYPE)
|
||||||
|
SET(CMAKE_BUILD_TYPE "Release")
|
||||||
|
ENDIF (NOT CMAKE_BUILD_TYPE)
|
||||||
|
ENDIF (IOS)
|
||||||
|
|
||||||
# Use subset of Windows.h
|
# Use subset of Windows.h
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
||||||
|
@ -220,11 +228,18 @@ ELSEIF( CMAKE_COMPILER_IS_MINGW )
|
||||||
ADD_DEFINITIONS( -U__STRICT_ANSI__ )
|
ADD_DEFINITIONS( -U__STRICT_ANSI__ )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (IOS)
|
IF ( IOS )
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3")
|
|
||||||
|
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og")
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Og")
|
||||||
|
ELSE()
|
||||||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
ENDIF( IOS )
|
||||||
|
|
||||||
IF (ASSIMP_COVERALLS)
|
IF (ASSIMP_COVERALLS)
|
||||||
MESSAGE(STATUS "Coveralls enabled")
|
MESSAGE(STATUS "Coveralls enabled")
|
||||||
INCLUDE(Coveralls)
|
INCLUDE(Coveralls)
|
||||||
|
@ -320,6 +335,8 @@ IF( NOT ZLIB_FOUND )
|
||||||
SET(ZLIB_FOUND 1)
|
SET(ZLIB_FOUND 1)
|
||||||
SET(ZLIB_LIBRARIES zlibstatic)
|
SET(ZLIB_LIBRARIES zlibstatic)
|
||||||
SET(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zlib ${CMAKE_CURRENT_BINARY_DIR}/contrib/zlib)
|
SET(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zlib ${CMAKE_CURRENT_BINARY_DIR}/contrib/zlib)
|
||||||
|
# need to ensure we don't link with system zlib or minizip as well.
|
||||||
|
SET(ASSIMP_BUILD_MINIZIP 1)
|
||||||
ELSE(NOT ZLIB_FOUND)
|
ELSE(NOT ZLIB_FOUND)
|
||||||
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
||||||
SET(ZLIB_LIBRARIES_LINKED -lz)
|
SET(ZLIB_LIBRARIES_LINKED -lz)
|
||||||
|
@ -327,7 +344,17 @@ ENDIF(NOT ZLIB_FOUND)
|
||||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
# Search for unzip
|
# Search for unzip
|
||||||
use_pkgconfig(UNZIP minizip)
|
IF ( NOT IOS )
|
||||||
|
IF( NOT ASSIMP_BUILD_MINIZIP )
|
||||||
|
use_pkgconfig(UNZIP minizip)
|
||||||
|
ENDIF( NOT ASSIMP_BUILD_MINIZIP )
|
||||||
|
ELSE ( NOT IOS )
|
||||||
|
IF(NOT BUILD_SHARED_LIBS)
|
||||||
|
IF( NOT ASSIMP_BUILD_MINIZIP )
|
||||||
|
use_pkgconfig(UNZIP minizip)
|
||||||
|
ENDIF( NOT ASSIMP_BUILD_MINIZIP )
|
||||||
|
ENDIF (NOT BUILD_SHARED_LIBS)
|
||||||
|
ENDIF ( NOT IOS )
|
||||||
|
|
||||||
IF ( ASSIMP_NO_EXPORT )
|
IF ( ASSIMP_NO_EXPORT )
|
||||||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT)
|
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT)
|
||||||
|
@ -412,7 +439,9 @@ IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
||||||
ENDIF ( WIN32 AND DirectX_D3DX9_LIBRARY )
|
ENDIF ( WIN32 AND DirectX_D3DX9_LIBRARY )
|
||||||
|
|
||||||
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
|
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
|
||||||
|
IF (NOT IOS)
|
||||||
ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ )
|
ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ )
|
||||||
|
ENDIF (NOT IOS)
|
||||||
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
||||||
|
|
||||||
IF ( ASSIMP_BUILD_SAMPLES)
|
IF ( ASSIMP_BUILD_SAMPLES)
|
||||||
|
|
|
@ -911,6 +911,12 @@ ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
||||||
|
|
||||||
ADD_LIBRARY( assimp ${assimp_src} )
|
ADD_LIBRARY( assimp ${assimp_src} )
|
||||||
|
|
||||||
|
TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
|
||||||
|
)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ${IRRXML_LIBRARY} )
|
TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ${IRRXML_LIBRARY} )
|
||||||
|
|
||||||
if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
|
if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||||
|
|
|
@ -105,8 +105,10 @@ void TriangulateProcess::Execute( aiScene* pScene)
|
||||||
bool bHas = false;
|
bool bHas = false;
|
||||||
for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
|
for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
|
||||||
{
|
{
|
||||||
if ( TriangulateMesh( pScene->mMeshes[ a ] ) ) {
|
if (pScene->mMeshes[ a ]) {
|
||||||
bHas = true;
|
if ( TriangulateMesh( pScene->mMeshes[ a ] ) ) {
|
||||||
|
bHas = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( bHas ) {
|
if ( bHas ) {
|
||||||
|
@ -285,7 +287,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
||||||
// We project it onto a plane to get a 2d triangle.
|
// We project it onto a plane to get a 2d triangle.
|
||||||
|
|
||||||
// Collect all vertices of of the polygon.
|
// Collect all vertices of of the polygon.
|
||||||
for (tmp = 0; tmp < max; ++tmp) {
|
for (tmp = 0; tmp < max; ++tmp) {
|
||||||
temp_verts3d[tmp] = verts[idx[tmp]];
|
temp_verts3d[tmp] = verts[idx[tmp]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -766,10 +766,17 @@ namespace glTF2
|
||||||
Ref<Accessor> indices;
|
Ref<Accessor> indices;
|
||||||
|
|
||||||
Ref<Material> material;
|
Ref<Material> material;
|
||||||
|
|
||||||
|
struct Target {
|
||||||
|
AccessorList position, normal, tangent;
|
||||||
|
};
|
||||||
|
std::vector<Target> targets;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<Primitive> primitives;
|
std::vector<Primitive> primitives;
|
||||||
|
|
||||||
|
std::vector<float> weights;
|
||||||
|
|
||||||
Mesh() {}
|
Mesh() {}
|
||||||
|
|
||||||
/// \fn void Read(Value& pJSON_Object, Asset& pAsset_Root)
|
/// \fn void Read(Value& pJSON_Object, Asset& pAsset_Root)
|
||||||
|
|
|
@ -931,6 +931,21 @@ namespace {
|
||||||
else return false;
|
else return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool GetAttribTargetVector(Mesh::Primitive& p, const int targetIndex, const char* attr, Mesh::AccessorList*& v, int& pos)
|
||||||
|
{
|
||||||
|
if ((pos = Compare(attr, "POSITION"))) {
|
||||||
|
v = &(p.targets[targetIndex].position);
|
||||||
|
}
|
||||||
|
else if ((pos = Compare(attr, "NORMAL"))) {
|
||||||
|
v = &(p.targets[targetIndex].normal);
|
||||||
|
}
|
||||||
|
else if ((pos = Compare(attr, "TANGENT"))) {
|
||||||
|
v = &(p.targets[targetIndex].tangent);
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Mesh::Read(Value& pJSON_Object, Asset& pAsset_Root)
|
inline void Mesh::Read(Value& pJSON_Object, Asset& pAsset_Root)
|
||||||
|
@ -965,6 +980,26 @@ inline void Mesh::Read(Value& pJSON_Object, Asset& pAsset_Root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Value* targetsArray = FindArray(primitive, "targets")) {
|
||||||
|
prim.targets.resize(targetsArray->Size());
|
||||||
|
for (unsigned int i = 0; i < targetsArray->Size(); ++i) {
|
||||||
|
Value& target = (*targetsArray)[i];
|
||||||
|
if (!target.IsObject()) continue;
|
||||||
|
for (Value::MemberIterator it = target.MemberBegin(); it != target.MemberEnd(); ++it) {
|
||||||
|
if (!it->value.IsUint()) continue;
|
||||||
|
const char* attr = it->name.GetString();
|
||||||
|
// Valid attribute semantics include POSITION, NORMAL, TANGENT
|
||||||
|
int undPos = 0;
|
||||||
|
Mesh::AccessorList* vec = 0;
|
||||||
|
if (GetAttribTargetVector(prim, i, attr, vec, undPos)) {
|
||||||
|
size_t idx = (attr[undPos] == '_') ? atoi(attr + undPos + 1) : 0;
|
||||||
|
if ((*vec).size() <= idx) (*vec).resize(idx + 1);
|
||||||
|
(*vec)[idx] = pAsset_Root.accessors.Retrieve(it->value.GetUint());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Value* indices = FindUInt(primitive, "indices")) {
|
if (Value* indices = FindUInt(primitive, "indices")) {
|
||||||
prim.indices = pAsset_Root.accessors.Retrieve(indices->GetUint());
|
prim.indices = pAsset_Root.accessors.Retrieve(indices->GetUint());
|
||||||
}
|
}
|
||||||
|
@ -974,6 +1009,16 @@ inline void Mesh::Read(Value& pJSON_Object, Asset& pAsset_Root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Value* weights = FindArray(pJSON_Object, "weights")) {
|
||||||
|
this->weights.resize(weights->Size());
|
||||||
|
for (unsigned int i = 0; i < weights->Size(); ++i) {
|
||||||
|
Value& weightValue = (*weights)[i];
|
||||||
|
if (weightValue.IsNumber()) {
|
||||||
|
this->weights[i] = weightValue.GetFloat();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Camera::Read(Value& obj, Asset& /*r*/)
|
inline void Camera::Read(Value& obj, Asset& /*r*/)
|
||||||
|
|
|
@ -51,6 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/ai_assert.h>
|
#include <assimp/ai_assert.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
|
#include <assimp/CreateAnimMesh.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -65,6 +66,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
using namespace glTF2;
|
using namespace glTF2;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
// generate bitangents from normals and tangents according to spec
|
||||||
|
struct Tangent {
|
||||||
|
aiVector3D xyz;
|
||||||
|
ai_real w;
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
//
|
//
|
||||||
// glTF2Importer
|
// glTF2Importer
|
||||||
|
@ -416,10 +424,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
|
||||||
// only extract tangents if normals are present
|
// only extract tangents if normals are present
|
||||||
if (attr.tangent.size() > 0 && attr.tangent[0]) {
|
if (attr.tangent.size() > 0 && attr.tangent[0]) {
|
||||||
// generate bitangents from normals and tangents according to spec
|
// generate bitangents from normals and tangents according to spec
|
||||||
struct Tangent {
|
Tangent *tangents = nullptr;
|
||||||
aiVector3D xyz;
|
|
||||||
ai_real w;
|
|
||||||
} *tangents = nullptr;
|
|
||||||
|
|
||||||
attr.tangent[0]->ExtractData(tangents);
|
attr.tangent[0]->ExtractData(tangents);
|
||||||
|
|
||||||
|
@ -445,11 +450,57 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Mesh::Primitive::Target>& targets = prim.targets;
|
||||||
|
if (targets.size() > 0) {
|
||||||
|
aim->mNumAnimMeshes = targets.size();
|
||||||
|
aim->mAnimMeshes = new aiAnimMesh*[aim->mNumAnimMeshes];
|
||||||
|
for (size_t i = 0; i < targets.size(); i++) {
|
||||||
|
aim->mAnimMeshes[i] = aiCreateAnimMesh(aim);
|
||||||
|
aiAnimMesh& aiAnimMesh = *(aim->mAnimMeshes[i]);
|
||||||
|
Mesh::Primitive::Target& target = targets[i];
|
||||||
|
|
||||||
|
if (target.position.size() > 0) {
|
||||||
|
aiVector3D *positionDiff = nullptr;
|
||||||
|
target.position[0]->ExtractData(positionDiff);
|
||||||
|
for(unsigned int vertexId = 0; vertexId < aim->mNumVertices; vertexId++) {
|
||||||
|
aiAnimMesh.mVertices[vertexId] += positionDiff[vertexId];
|
||||||
|
}
|
||||||
|
delete [] positionDiff;
|
||||||
|
}
|
||||||
|
if (target.normal.size() > 0) {
|
||||||
|
aiVector3D *normalDiff = nullptr;
|
||||||
|
target.normal[0]->ExtractData(normalDiff);
|
||||||
|
for(unsigned int vertexId = 0; vertexId < aim->mNumVertices; vertexId++) {
|
||||||
|
aiAnimMesh.mNormals[vertexId] += normalDiff[vertexId];
|
||||||
|
}
|
||||||
|
delete [] normalDiff;
|
||||||
|
}
|
||||||
|
if (target.tangent.size() > 0) {
|
||||||
|
Tangent *tangent = nullptr;
|
||||||
|
attr.tangent[0]->ExtractData(tangent);
|
||||||
|
|
||||||
|
aiVector3D *tangentDiff = nullptr;
|
||||||
|
target.tangent[0]->ExtractData(tangentDiff);
|
||||||
|
|
||||||
|
for (unsigned int vertexId = 0; vertexId < aim->mNumVertices; ++vertexId) {
|
||||||
|
tangent[vertexId].xyz += tangentDiff[vertexId];
|
||||||
|
aiAnimMesh.mTangents[vertexId] = tangent[vertexId].xyz;
|
||||||
|
aiAnimMesh.mBitangents[vertexId] = (aiAnimMesh.mNormals[vertexId] ^ tangent[vertexId].xyz) * tangent[vertexId].w;
|
||||||
|
}
|
||||||
|
delete [] tangent;
|
||||||
|
delete [] tangentDiff;
|
||||||
|
}
|
||||||
|
if (mesh.weights.size() > i) {
|
||||||
|
aiAnimMesh.mWeight = mesh.weights[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
aiFace* faces = 0;
|
||||||
|
unsigned int nFaces = 0;
|
||||||
|
|
||||||
if (prim.indices) {
|
if (prim.indices) {
|
||||||
aiFace* faces = 0;
|
|
||||||
unsigned int nFaces = 0;
|
|
||||||
|
|
||||||
unsigned int count = prim.indices->count;
|
unsigned int count = prim.indices->count;
|
||||||
|
|
||||||
Accessor::Indexer data = prim.indices->GetIndexer();
|
Accessor::Indexer data = prim.indices->GetIndexer();
|
||||||
|
@ -514,14 +565,78 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else { // no indices provided so directly generate from counts
|
||||||
|
|
||||||
if (faces) {
|
// use the already determined count as it includes checks
|
||||||
aim->mFaces = faces;
|
unsigned int count = aim->mNumVertices;
|
||||||
aim->mNumFaces = nFaces;
|
|
||||||
ai_assert(CheckValidFacesIndices(faces, nFaces, aim->mNumVertices));
|
switch (prim.mode) {
|
||||||
|
case PrimitiveMode_POINTS: {
|
||||||
|
nFaces = count;
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
for (unsigned int i = 0; i < count; ++i) {
|
||||||
|
SetFace(faces[i], i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PrimitiveMode_LINES: {
|
||||||
|
nFaces = count / 2;
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
for (unsigned int i = 0; i < count; i += 2) {
|
||||||
|
SetFace(faces[i / 2], i, i + 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PrimitiveMode_LINE_LOOP:
|
||||||
|
case PrimitiveMode_LINE_STRIP: {
|
||||||
|
nFaces = count - ((prim.mode == PrimitiveMode_LINE_STRIP) ? 1 : 0);
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
SetFace(faces[0], 0, 1);
|
||||||
|
for (unsigned int i = 2; i < count; ++i) {
|
||||||
|
SetFace(faces[i - 1], faces[i - 2].mIndices[1], i);
|
||||||
|
}
|
||||||
|
if (prim.mode == PrimitiveMode_LINE_LOOP) { // close the loop
|
||||||
|
SetFace(faces[count - 1], faces[count - 2].mIndices[1], faces[0].mIndices[0]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PrimitiveMode_TRIANGLES: {
|
||||||
|
nFaces = count / 3;
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
for (unsigned int i = 0; i < count; i += 3) {
|
||||||
|
SetFace(faces[i / 3], i, i + 1, i + 2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PrimitiveMode_TRIANGLE_STRIP: {
|
||||||
|
nFaces = count - 2;
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
SetFace(faces[0], 0, 1, 2);
|
||||||
|
for (unsigned int i = 3; i < count; ++i) {
|
||||||
|
SetFace(faces[i - 2], faces[i - 1].mIndices[1], faces[i - 1].mIndices[2], i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PrimitiveMode_TRIANGLE_FAN:
|
||||||
|
nFaces = count - 2;
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
SetFace(faces[0], 0, 1, 2);
|
||||||
|
for (unsigned int i = 3; i < count; ++i) {
|
||||||
|
SetFace(faces[i - 2], faces[0].mIndices[0], faces[i - 1].mIndices[2], i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (faces) {
|
||||||
|
aim->mFaces = faces;
|
||||||
|
aim->mNumFaces = nFaces;
|
||||||
|
ai_assert(CheckValidFacesIndices(faces, nFaces, aim->mNumVertices));
|
||||||
|
}
|
||||||
|
|
||||||
if (prim.material) {
|
if (prim.material) {
|
||||||
aim->mMaterialIndex = prim.material.GetIndex();
|
aim->mMaterialIndex = prim.material.GetIndex();
|
||||||
|
|
|
@ -351,10 +351,10 @@ void glTFImporter::ImportMeshes(glTF::Asset& r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (prim.indices) {
|
aiFace* faces = 0;
|
||||||
aiFace* faces = 0;
|
unsigned int nFaces = 0;
|
||||||
unsigned int nFaces = 0;
|
|
||||||
|
|
||||||
|
if (prim.indices) {
|
||||||
unsigned int count = prim.indices->count;
|
unsigned int count = prim.indices->count;
|
||||||
|
|
||||||
Accessor::Indexer data = prim.indices->GetIndexer();
|
Accessor::Indexer data = prim.indices->GetIndexer();
|
||||||
|
@ -419,14 +419,78 @@ void glTFImporter::ImportMeshes(glTF::Asset& r)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else { // no indices provided so directly generate from counts
|
||||||
|
|
||||||
if (faces) {
|
// use the already determined count as it includes checks
|
||||||
aim->mFaces = faces;
|
unsigned int count = aim->mNumVertices;
|
||||||
aim->mNumFaces = nFaces;
|
|
||||||
ai_assert(CheckValidFacesIndices(faces, nFaces, aim->mNumVertices));
|
switch (prim.mode) {
|
||||||
|
case PrimitiveMode_POINTS: {
|
||||||
|
nFaces = count;
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
for (unsigned int i = 0; i < count; ++i) {
|
||||||
|
SetFace(faces[i], i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PrimitiveMode_LINES: {
|
||||||
|
nFaces = count / 2;
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
for (unsigned int i = 0; i < count; i += 2) {
|
||||||
|
SetFace(faces[i / 2], i, i + 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PrimitiveMode_LINE_LOOP:
|
||||||
|
case PrimitiveMode_LINE_STRIP: {
|
||||||
|
nFaces = count - ((prim.mode == PrimitiveMode_LINE_STRIP) ? 1 : 0);
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
SetFace(faces[0], 0, 1);
|
||||||
|
for (unsigned int i = 2; i < count; ++i) {
|
||||||
|
SetFace(faces[i - 1], faces[i - 2].mIndices[1], i);
|
||||||
|
}
|
||||||
|
if (prim.mode == PrimitiveMode_LINE_LOOP) { // close the loop
|
||||||
|
SetFace(faces[count - 1], faces[count - 2].mIndices[1], faces[0].mIndices[0]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PrimitiveMode_TRIANGLES: {
|
||||||
|
nFaces = count / 3;
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
for (unsigned int i = 0; i < count; i += 3) {
|
||||||
|
SetFace(faces[i / 3], i, i + 1, i + 2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PrimitiveMode_TRIANGLE_STRIP: {
|
||||||
|
nFaces = count - 2;
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
SetFace(faces[0], 0, 1, 2);
|
||||||
|
for (unsigned int i = 3; i < count; ++i) {
|
||||||
|
SetFace(faces[i - 2], faces[i - 1].mIndices[1], faces[i - 1].mIndices[2], i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PrimitiveMode_TRIANGLE_FAN:
|
||||||
|
nFaces = count - 2;
|
||||||
|
faces = new aiFace[nFaces];
|
||||||
|
SetFace(faces[0], 0, 1, 2);
|
||||||
|
for (unsigned int i = 3; i < count; ++i) {
|
||||||
|
SetFace(faces[i - 2], faces[0].mIndices[0], faces[i - 1].mIndices[2], i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (faces) {
|
||||||
|
aim->mFaces = faces;
|
||||||
|
aim->mNumFaces = nFaces;
|
||||||
|
ai_assert(CheckValidFacesIndices(faces, nFaces, aim->mNumVertices));
|
||||||
|
}
|
||||||
|
|
||||||
if (prim.material) {
|
if (prim.material) {
|
||||||
aim->mMaterialIndex = prim.material.GetIndex();
|
aim->mMaterialIndex = prim.material.GetIndex();
|
||||||
|
|
|
@ -100,10 +100,16 @@ static bool isUnsignedIntegerType( Value::ValueType integerType ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static DDLNode *createDDLNode( Text *id, OpenDDLParser *parser ) {
|
static DDLNode *createDDLNode( Text *id, OpenDDLParser *parser ) {
|
||||||
|
// Basic checks
|
||||||
if( ddl_nullptr == id || ddl_nullptr == parser ) {
|
if( ddl_nullptr == id || ddl_nullptr == parser ) {
|
||||||
return ddl_nullptr;
|
return ddl_nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the buffer is empty ( an empty node ) return nullptr
|
||||||
|
if ( ddl_nullptr == id->m_buffer ) {
|
||||||
|
return ddl_nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string type( id->m_buffer );
|
const std::string type( id->m_buffer );
|
||||||
DDLNode *parent( parser->top() );
|
DDLNode *parent( parser->top() );
|
||||||
DDLNode *node = DDLNode::create( type, "", parent );
|
DDLNode *node = DDLNode::create( type, "", parent );
|
||||||
|
|
|
@ -3,17 +3,15 @@ INCLUDE(CMakeForceCompiler)
|
||||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||||
SET (CMAKE_SYSTEM_PROCESSOR "arm64")
|
SET (CMAKE_SYSTEM_PROCESSOR "arm64")
|
||||||
|
SET (IOS TRUE)
|
||||||
|
|
||||||
SET (SDKVER "7.1")
|
SET (IOS_SDK_DEVICE iPhoneOS)
|
||||||
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
|
|
||||||
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
|
|
||||||
SET (CC "${DEVROOT}/usr/bin/clang")
|
|
||||||
SET (CXX "${DEVROOT}/usr/bin/clang++")
|
|
||||||
|
|
||||||
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
|
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||||
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
|
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||||
|
|
||||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
|
||||||
|
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -3,17 +3,15 @@ INCLUDE(CMakeForceCompiler)
|
||||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||||
SET (CMAKE_SYSTEM_PROCESSOR "armv6")
|
SET (CMAKE_SYSTEM_PROCESSOR "armv6")
|
||||||
|
SET (IOS TRUE)
|
||||||
|
|
||||||
SET (SDKVER "7.1")
|
SET (IOS_SDK_DEVICE iPhoneOS)
|
||||||
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
|
|
||||||
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
|
|
||||||
SET (CC "${DEVROOT}/usr/bin/clang")
|
|
||||||
SET (CXX "${DEVROOT}/usr/bin/clang++")
|
|
||||||
|
|
||||||
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
|
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||||
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
|
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||||
|
|
||||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
|
||||||
|
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -3,17 +3,15 @@ INCLUDE(CMakeForceCompiler)
|
||||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||||
SET (CMAKE_SYSTEM_PROCESSOR "armv7s")
|
SET (CMAKE_SYSTEM_PROCESSOR "armv7s")
|
||||||
|
SET (IOS TRUE)
|
||||||
|
|
||||||
SET (SDKVER "7.1")
|
SET (IOS_SDK_DEVICE iPhoneOS)
|
||||||
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
|
|
||||||
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
|
|
||||||
SET (CC "${DEVROOT}/usr/bin/clang")
|
|
||||||
SET (CXX "${DEVROOT}/usr/bin/clang++")
|
|
||||||
|
|
||||||
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
|
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||||
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
|
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||||
|
|
||||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
|
||||||
|
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -3,17 +3,15 @@ INCLUDE(CMakeForceCompiler)
|
||||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||||
SET (CMAKE_SYSTEM_PROCESSOR "armv7")
|
SET (CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||||
|
SET (IOS TRUE)
|
||||||
|
|
||||||
SET (SDKVER "7.1")
|
SET (IOS_SDK_DEVICE iPhoneOS)
|
||||||
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
|
|
||||||
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
|
|
||||||
SET (CC "${DEVROOT}/usr/bin/clang")
|
|
||||||
SET (CXX "${DEVROOT}/usr/bin/clang++")
|
|
||||||
|
|
||||||
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
|
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||||
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
|
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||||
|
|
||||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
|
||||||
|
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -3,18 +3,15 @@ INCLUDE(CMakeForceCompiler)
|
||||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||||
SET (CMAKE_SYSTEM_PROCESSOR "i386")
|
SET (CMAKE_SYSTEM_PROCESSOR "i386")
|
||||||
|
SET (IOS TRUE)
|
||||||
|
|
||||||
SET (SDKVER "7.1")
|
SET (IOS_SDK_DEVICE iPhoneSimulator)
|
||||||
|
|
||||||
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
|
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||||
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVER}.sdk")
|
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||||
SET (CC "${DEVROOT}/usr/bin/clang")
|
|
||||||
SET (CXX "${DEVROOT}/usr/bin/clang++")
|
|
||||||
|
|
||||||
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
|
|
||||||
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
|
|
||||||
|
|
||||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -3,18 +3,15 @@ INCLUDE(CMakeForceCompiler)
|
||||||
SET (CMAKE_CROSSCOMPILING TRUE)
|
SET (CMAKE_CROSSCOMPILING TRUE)
|
||||||
SET (CMAKE_SYSTEM_NAME "Darwin")
|
SET (CMAKE_SYSTEM_NAME "Darwin")
|
||||||
SET (CMAKE_SYSTEM_PROCESSOR "x86_64")
|
SET (CMAKE_SYSTEM_PROCESSOR "x86_64")
|
||||||
|
SET (IOS TRUE)
|
||||||
|
|
||||||
SET (SDKVER "7.1")
|
SET (IOS_SDK_DEVICE iPhoneSimulator)
|
||||||
|
|
||||||
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
|
SET (SDKVER "${IOS_SDK_VERSION}")
|
||||||
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVER}.sdk")
|
SET (DEVROOT "${XCODE_ROOT_DIR}/Platforms/${IOS_SDK_DEVICE}.platform/Developer")
|
||||||
SET (CC "${DEVROOT}/usr/bin/clang")
|
|
||||||
SET (CXX "${DEVROOT}/usr/bin/clang++")
|
|
||||||
|
|
||||||
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
|
|
||||||
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
|
|
||||||
|
|
||||||
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -6,24 +6,41 @@
|
||||||
|
|
||||||
BUILD_DIR="./lib/iOS"
|
BUILD_DIR="./lib/iOS"
|
||||||
|
|
||||||
IOS_SDK_VERSION=
|
###################################
|
||||||
IOS_SDK_TARGET=6.0
|
# SDK Version
|
||||||
#(iPhoneOS iPhoneSimulator) -- determined from arch
|
###################################
|
||||||
IOS_SDK_DEVICE=
|
IOS_SDK_VERSION=$(xcodebuild -version -sdk iphoneos | grep SDKVersion | cut -f2 -d ':' | tr -d '[[:space:]]')
|
||||||
|
###################################
|
||||||
|
|
||||||
XCODE_ROOT_DIR=/Applications/Xcode.app/Contents
|
###################################
|
||||||
TOOLCHAIN=$XCODE_ROOT_DIR//Developer/Toolchains/XcodeDefault.xctoolchain
|
# BUILD Configuration
|
||||||
|
###################################
|
||||||
|
|
||||||
BUILD_ARCHS_DEVICE="armv7 armv7s arm64"
|
BUILD_SHARED_LIBS=OFF
|
||||||
BUILD_ARCHS_SIMULATOR="i386 x86_64"
|
BUILD_TYPE=Release
|
||||||
BUILD_ARCHS_ALL=(armv7 armv7s arm64 i386 x86_64)
|
|
||||||
|
################################################
|
||||||
|
# Minimum iOS deployment target version
|
||||||
|
################################################
|
||||||
|
MIN_IOS_VERSION="6.0"
|
||||||
|
|
||||||
|
IOS_SDK_TARGET=$MIN_IOS_VERSION
|
||||||
|
XCODE_ROOT_DIR=$(xcode-select --print-path)
|
||||||
|
TOOLCHAIN=$XCODE_ROOT_DIR/Toolchains/XcodeDefault.xctoolchain
|
||||||
|
|
||||||
|
CMAKE_C_COMPILER=$(xcrun -find cc)
|
||||||
|
CMAKE_CXX_COMPILER=$(xcrun -find c++)
|
||||||
|
|
||||||
|
BUILD_ARCHS_DEVICE="arm64 armv7s armv7"
|
||||||
|
BUILD_ARCHS_SIMULATOR="x86_64 i386"
|
||||||
|
BUILD_ARCHS_ALL=($BUILD_ARCHS_DEVICE $BUILD_ARCHS_SIMULATOR)
|
||||||
|
|
||||||
CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min)
|
CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min)
|
||||||
CPP_DEV_TARGET=
|
CPP_DEV_TARGET=
|
||||||
CPP_STD_LIB_LIST=(libc++ libstdc++)
|
CPP_STD_LIB_LIST=(libc++ libstdc++)
|
||||||
CPP_STD_LIB=
|
CPP_STD_LIB=
|
||||||
CPP_STD_LIST=(c++11 c++14)
|
CPP_STD_LIST=(c++11 c++14)
|
||||||
CPP_STD=
|
CPP_STD=c++11
|
||||||
|
|
||||||
function join { local IFS="$1"; shift; echo "$*"; }
|
function join { local IFS="$1"; shift; echo "$*"; }
|
||||||
|
|
||||||
|
@ -41,26 +58,41 @@ build_arch()
|
||||||
echo '[!] Target SDK set to DEVICE.'
|
echo '[!] Target SDK set to DEVICE.'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS
|
unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS CMAKE_CLI_INPUT
|
||||||
|
|
||||||
export DEVROOT=$XCODE_ROOT_DIR/Developer/Platforms/$IOS_SDK_DEVICE.platform/Developer
|
#export CC="$(xcrun -sdk iphoneos -find clang)"
|
||||||
|
#export CPP="$CC -E"
|
||||||
|
export DEVROOT=$XCODE_ROOT_DIR/Platforms/$IOS_SDK_DEVICE.platform/Developer
|
||||||
export SDKROOT=$DEVROOT/SDKs/$IOS_SDK_DEVICE$IOS_SDK_VERSION.sdk
|
export SDKROOT=$DEVROOT/SDKs/$IOS_SDK_DEVICE$IOS_SDK_VERSION.sdk
|
||||||
export CFLAGS="-arch $1 -pipe -no-cpp-precomp -stdlib=$CPP_STD_LIB -isysroot $SDKROOT -$CPP_DEV_TARGET=$IOS_SDK_TARGET -I$SDKROOT/usr/include/"
|
export CFLAGS="-arch $1 -pipe -no-cpp-precomp -stdlib=$CPP_STD_LIB -isysroot $SDKROOT -I$SDKROOT/usr/include/ -miphoneos-version-min=$IOS_SDK_TARGET"
|
||||||
export LDFLAGS="-L$SDKROOT/usr/lib/"
|
if [[ "$BUILD_TYPE" =~ "Debug" ]]; then
|
||||||
export CPPFLAGS=$CFLAGS
|
export CFLAGS="$CFLAGS -Og"
|
||||||
|
else
|
||||||
|
export CFLAGS="$CFLAGS -O3"
|
||||||
|
fi
|
||||||
|
export LDFLAGS="-arch $1 -isysroot $SDKROOT -L$SDKROOT/usr/lib/"
|
||||||
|
export CPPFLAGS="$CFLAGS"
|
||||||
export CXXFLAGS="$CFLAGS -std=$CPP_STD"
|
export CXXFLAGS="$CFLAGS -std=$CPP_STD"
|
||||||
|
|
||||||
rm CMakeCache.txt
|
rm CMakeCache.txt
|
||||||
|
|
||||||
cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=OFF
|
CMAKE_CLI_INPUT="-DCMAKE_C_COMPILER=$CMAKE_C_COMPILER -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_BOOST_WORKAROUND=ON -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS"
|
||||||
|
|
||||||
|
echo "[!] Running CMake with -G 'Unix Makefiles' $CMAKE_CLI_INPUT"
|
||||||
|
|
||||||
|
cmake -G 'Unix Makefiles' ${CMAKE_CLI_INPUT}
|
||||||
|
|
||||||
echo "[!] Building $1 library"
|
echo "[!] Building $1 library"
|
||||||
|
|
||||||
$XCODE_ROOT_DIR/Developer/usr/bin/make clean
|
xcrun -run make clean
|
||||||
$XCODE_ROOT_DIR/Developer/usr/bin/make assimp -j 8 -l
|
xcrun -run make assimp -j 8 -l
|
||||||
|
|
||||||
echo "[!] Moving built libraries into: $BUILD_DIR/$1/"
|
if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then
|
||||||
|
echo "[!] Moving built dynamic libraries into: $BUILD_DIR/$1/"
|
||||||
|
mv ./lib/*.dylib $BUILD_DIR/$1/
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[!] Moving built static libraries into: $BUILD_DIR/$1/"
|
||||||
mv ./lib/*.a $BUILD_DIR/$1/
|
mv ./lib/*.a $BUILD_DIR/$1/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,12 +117,22 @@ for i in "$@"; do
|
||||||
DEPLOY_ARCHS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
|
DEPLOY_ARCHS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
|
||||||
echo "[!] Selecting architectures: $DEPLOY_ARCHS"
|
echo "[!] Selecting architectures: $DEPLOY_ARCHS"
|
||||||
;;
|
;;
|
||||||
|
--debug)
|
||||||
|
BUILD_TYPE=Debug
|
||||||
|
echo "[!] Selecting build type: Debug"
|
||||||
|
;;
|
||||||
|
--shared-lib)
|
||||||
|
BUILD_SHARED_LIBS=ON
|
||||||
|
echo "[!] Will generate dynamic libraries"
|
||||||
|
;;
|
||||||
-n|--no-fat)
|
-n|--no-fat)
|
||||||
DEPLOY_FAT=0
|
DEPLOY_FAT=0
|
||||||
echo "[!] Fat binary will not be created."
|
echo "[!] Fat binary will not be created."
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
echo " - don't build fat library (--no-fat)."
|
echo " - don't build fat library (--no-fat)."
|
||||||
|
echo " - Include debug information and symbols, no compiler optimizations (--debug)."
|
||||||
|
echo " - generate dynamic libraries rather than static ones (--shared-lib)."
|
||||||
echo " - supported architectures (--archs): $(echo $(join , ${BUILD_ARCHS_ALL[*]}) | sed 's/,/, /g')"
|
echo " - supported architectures (--archs): $(echo $(join , ${BUILD_ARCHS_ALL[*]}) | sed 's/,/, /g')"
|
||||||
echo " - supported C++ STD libs (--stdlib): $(echo $(join , ${CPP_STD_LIB_LIST[*]}) | sed 's/,/, /g')"
|
echo " - supported C++ STD libs (--stdlib): $(echo $(join , ${CPP_STD_LIB_LIST[*]}) | sed 's/,/, /g')"
|
||||||
echo " - supported C++ standards (--std): $(echo $(join , ${CPP_STD_LIST[*]}) | sed 's/,/, /g')"
|
echo " - supported C++ standards (--std): $(echo $(join , ${CPP_STD_LIST[*]}) | sed 's/,/, /g')"
|
||||||
|
@ -105,29 +147,56 @@ cd ../../
|
||||||
rm -rf $BUILD_DIR
|
rm -rf $BUILD_DIR
|
||||||
|
|
||||||
for ARCH_TARGET in $DEPLOY_ARCHS; do
|
for ARCH_TARGET in $DEPLOY_ARCHS; do
|
||||||
|
echo "Creating folder: $BUILD_DIR/$ARCH_TARGET"
|
||||||
mkdir -p $BUILD_DIR/$ARCH_TARGET
|
mkdir -p $BUILD_DIR/$ARCH_TARGET
|
||||||
|
echo "Building for arc: $ARCH_TARGET"
|
||||||
build_arch $ARCH_TARGET
|
build_arch $ARCH_TARGET
|
||||||
#rm ./lib/libassimp.a
|
#rm ./lib/libassimp.a
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
make_fat_binary()
|
make_fat_static_or_shared_binary()
|
||||||
|
{
|
||||||
|
LIB_NAME=$1
|
||||||
|
LIPO_ARGS=''
|
||||||
|
for ARCH_TARGET in $DEPLOY_ARCHS; do
|
||||||
|
if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then
|
||||||
|
LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.dylib "
|
||||||
|
else
|
||||||
|
LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a "
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ "$BUILD_SHARED_LIBS" =~ "ON" ]]; then
|
||||||
|
LIPO_ARGS="$LIPO_ARGS -create -output $BUILD_DIR/$LIB_NAME-fat.dylib"
|
||||||
|
else
|
||||||
|
LIPO_ARGS="$LIPO_ARGS -create -output $BUILD_DIR/$LIB_NAME-fat.a"
|
||||||
|
fi
|
||||||
|
lipo $LIPO_ARGS
|
||||||
|
}
|
||||||
|
|
||||||
|
make_fat_static_binary()
|
||||||
{
|
{
|
||||||
LIB_NAME=$1
|
LIB_NAME=$1
|
||||||
LIPO_ARGS=''
|
LIPO_ARGS=''
|
||||||
for ARCH_TARGET in $DEPLOY_ARCHS; do
|
for ARCH_TARGET in $DEPLOY_ARCHS; do
|
||||||
LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a "
|
LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/$LIB_NAME.a "
|
||||||
done
|
done
|
||||||
LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/$LIB_NAME-fat.a"
|
LIPO_ARGS="$LIPO_ARGS -create -output $BUILD_DIR/$LIB_NAME-fat.a"
|
||||||
lipo $LIPO_ARGS
|
lipo $LIPO_ARGS
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$DEPLOY_FAT" -eq 1 ]]; then
|
if [[ "$DEPLOY_FAT" -eq 1 ]]; then
|
||||||
echo '[+] Creating fat binaries ...'
|
echo '[+] Creating fat binaries ...'
|
||||||
|
|
||||||
make_fat_binary 'libassimp'
|
if [[ "$BUILD_TYPE" =~ "Debug" ]]; then
|
||||||
make_fat_binary 'libIrrXML'
|
make_fat_static_or_shared_binary 'libassimpd'
|
||||||
make_fat_binary 'libzlibstatic'
|
make_fat_static_binary 'libIrrXMLd'
|
||||||
|
make_fat_static_binary 'libzlibstaticd'
|
||||||
|
else
|
||||||
|
make_fat_static_or_shared_binary 'libassimp'
|
||||||
|
make_fat_static_binary 'libIrrXML'
|
||||||
|
make_fat_static_binary 'libzlibstatic'
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[!] Done! The fat binaries can be found at $BUILD_DIR"
|
echo "[!] Done! The fat binaries can be found at $BUILD_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
CameraObject {
|
||||||
|
Param (attrib = "fov") { float { 0.97 } }
|
||||||
|
Param (attrib = "near") { float { 1.5 } }
|
||||||
|
Param (attrib = "far") { float { 150.0 } }
|
||||||
|
}
|
||||||
|
|
||||||
|
CameraObject {}
|
|
@ -68,3 +68,9 @@ TEST_F( utOpenGEXImportExport, Importissue1262_NoCrash ) {
|
||||||
EXPECT_NE( nullptr, scene );
|
EXPECT_NE( nullptr, scene );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(utOpenGEXImportExport, Importissue1340_EmptyCameraObject) {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OpenGEX/empty_camera.ogex", 0);
|
||||||
|
EXPECT_NE(nullptr, scene);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue