Merge pull request #1 from assimp/master

Fast forward to upstream
pull/2303/head
RichardTea 2019-03-05 12:25:42 +00:00 committed by GitHub
commit 762c09988c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
595 changed files with 2135 additions and 6747 deletions

View File

@ -1,6 +1,6 @@
# Open Asset Import Library (assimp) # Open Asset Import Library (assimp)
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Copyright (c) 2006-2018, assimp team # Copyright (c) 2006-2019, assimp team
# All rights reserved. # All rights reserved.
# #
@ -198,7 +198,7 @@ CONFIGURE_FILE(
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h ${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h
) )
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES( BEFORE
./ ./
include include
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}

View File

@ -1,7 +1,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
================================== ==================================
A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data. A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data.
### Current build status ### ### Current project status ###
[![Linux Build Status](https://travis-ci.org/assimp/assimp.svg)](https://travis-ci.org/assimp/assimp) [![Linux Build Status](https://travis-ci.org/assimp/assimp.svg)](https://travis-ci.org/assimp/assimp)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/tmo433wax6u6cjp4?svg=true)](https://ci.appveyor.com/project/kimkulling/assimp) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/tmo433wax6u6cjp4?svg=true)](https://ci.appveyor.com/project/kimkulling/assimp)
<a href="https://scan.coverity.com/projects/5607"> <a href="https://scan.coverity.com/projects/5607">
@ -12,6 +12,7 @@ A library to import and export various 3d-model-formats including scene-post-pro
[![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue") [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue")
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5be56faac64f46fc941ac890fb4febef)](https://www.codacy.com/app/kimkulling/assimp?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=assimp/assimp&amp;utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/5be56faac64f46fc941ac890fb4febef)](https://www.codacy.com/app/kimkulling/assimp?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=assimp/assimp&amp;utm_campaign=Badge_Grade)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/assimp/assimp.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/assimp/assimp/alerts/)
<br> <br>
APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS. APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS.

View File

@ -15,8 +15,8 @@ matrix:
image: image:
- Visual Studio 2013 - Visual Studio 2013
- Visual Studio 2015 # - Visual Studio 2015
- Visual Studio 2017 # - Visual Studio 2017
platform: platform:
- Win32 - Win32

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
@ -249,13 +249,14 @@ void Discreet3DSImporter::ApplyMasterScale(aiScene* pScene)
// Reads a new chunk from the file // Reads a new chunk from the file
void Discreet3DSImporter::ReadChunk(Discreet3DS::Chunk* pcOut) void Discreet3DSImporter::ReadChunk(Discreet3DS::Chunk* pcOut)
{ {
ai_assert(pcOut != NULL); ai_assert(pcOut != nullptr);
pcOut->Flag = stream->GetI2(); pcOut->Flag = stream->GetI2();
pcOut->Size = stream->GetI4(); pcOut->Size = stream->GetI4();
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSize()) if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSize()) {
throw DeadlyImportError("Chunk is too large"); throw DeadlyImportError("Chunk is too large");
}
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSizeToLimit()) { if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSizeToLimit()) {
ASSIMP_LOG_ERROR("3DS: Chunk overflow"); ASSIMP_LOG_ERROR("3DS: Chunk overflow");
@ -1343,15 +1344,16 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Read a percentage chunk // Read a percentage chunk
ai_real Discreet3DSImporter::ParsePercentageChunk() ai_real Discreet3DSImporter::ParsePercentageChunk() {
{
Discreet3DS::Chunk chunk; Discreet3DS::Chunk chunk;
ReadChunk(&chunk); ReadChunk(&chunk);
if (Discreet3DS::CHUNK_PERCENTF == chunk.Flag) if (Discreet3DS::CHUNK_PERCENTF == chunk.Flag) {
return stream->GetF4(); return stream->GetF4() * ai_real(100) / ai_real(0xFFFF);
else if (Discreet3DS::CHUNK_PERCENTW == chunk.Flag) } else if (Discreet3DS::CHUNK_PERCENTW == chunk.Flag) {
return (ai_real)((uint16_t)stream->GetI2()) / (ai_real)0xFFFF; return (ai_real)((uint16_t)stream->GetI2()) / (ai_real)0xFFFF;
}
return get_qnan(); return get_qnan();
} }

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -4,7 +4,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.
@ -760,7 +760,12 @@ public:
if (!out) return; if (!out) return;
time_t tt = time(NULL); time_t tt = time(NULL);
#if _WIN32
tm* p = gmtime(&tt); tm* p = gmtime(&tt);
#else
struct tm now;
tm* p = gmtime_r(&tt, &now);
#endif
// header // header
char s[64]; char s[64];

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
@ -60,7 +60,6 @@ ASSIMP_API size_t aiGetExportFormatCount(void)
return Exporter().GetExportFormatCount(); return Exporter().GetExportFormatCount();
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t index) ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t index)
{ {

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.
@ -184,8 +184,13 @@ static std::string encodeXML(const std::string& data) {
static static
void WriteDump(const aiScene* scene, IOStream* io, bool shortened) { void WriteDump(const aiScene* scene, IOStream* io, bool shortened) {
time_t tt = ::time( NULL ); time_t tt = ::time( NULL );
tm* p = ::gmtime( &tt ); #if _WIN32
ai_assert( nullptr != p ); tm* p = gmtime(&tt);
#else
struct tm now;
tm* p = gmtime_r(&tt, &now);
#endif
ai_assert(nullptr != p);
// write header // write header
std::string header( std::string header(

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -4,7 +4,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -4,7 +4,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -1,7 +1,7 @@
# Open Asset Import Library (assimp) # Open Asset Import Library (assimp)
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# #
# Copyright (c) 2006-2018, assimp team # Copyright (c) 2006-2019, assimp team
# All rights reserved. # All rights reserved.
@ -47,6 +47,11 @@
cmake_minimum_required( VERSION 2.6 ) cmake_minimum_required( VERSION 2.6 )
SET( HEADER_PATH ../include/assimp ) SET( HEADER_PATH ../include/assimp )
if(NOT ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
message(WARNING "Requesting Android JNI I/O-System in non-Android toolchain. Resetting ASSIMP_ANDROID_JNIIOSYSTEM to OFF.")
set(ASSIMP_ANDROID_JNIIOSYSTEM OFF)
endif(NOT ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
SET( COMPILER_HEADERS SET( COMPILER_HEADERS
${HEADER_PATH}/Compiler/pushpack1.h ${HEADER_PATH}/Compiler/pushpack1.h
${HEADER_PATH}/Compiler/poppack1.h ${HEADER_PATH}/Compiler/poppack1.h
@ -890,7 +895,7 @@ SET( assimp_src
${PostProcessing_SRCS} ${PostProcessing_SRCS}
${MaterialSystem_SRCS} ${MaterialSystem_SRCS}
${STEPParser_SRCS} ${STEPParser_SRCS}
${Step_SRCS} # ${Step_SRCS} check if we need a different approach
# Model Support # Model Support
${ASSIMP_LOADER_SRCS} ${ASSIMP_LOADER_SRCS}
@ -932,11 +937,11 @@ TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
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(ASSIMP_ANDROID_JNIIOSYSTEM)
set(ASSIMP_ANDROID_JNIIOSYSTEM_PATH port/AndroidJNI) set(ASSIMP_ANDROID_JNIIOSYSTEM_PATH port/AndroidJNI)
add_subdirectory(../${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/ ../${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/) add_subdirectory(../${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/ ../${ASSIMP_ANDROID_JNIIOSYSTEM_PATH}/)
target_link_libraries(assimp android_jniiosystem) target_link_libraries(assimp android_jniiosystem)
endif(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM) endif(ASSIMP_ANDROID_JNIIOSYSTEM)
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
TARGET_LINK_LIBRARIES(assimp optimized ${C4D_RELEASE_LIBRARIES}) TARGET_LINK_LIBRARIES(assimp optimized ${C4D_RELEASE_LIBRARIES})

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -4,7 +4,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
@ -109,13 +109,13 @@ ColladaLoader::~ColladaLoader() {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
{
// check file extension // check file extension
std::string extension = GetExtension(pFile); std::string extension = GetExtension(pFile);
if( extension == "dae") if (extension == "dae") {
return true; return true;
}
// XML - too generic, we need to open the file and search for typical keywords // XML - too generic, we need to open the file and search for typical keywords
if( extension == "xml" || !extension.length() || checkSig) { if( extension == "xml" || !extension.length() || checkSig) {
@ -123,10 +123,13 @@ bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, boo
* support a specific file extension in general pIOHandler * support a specific file extension in general pIOHandler
* might be NULL and it's our duty to return true here. * might be NULL and it's our duty to return true here.
*/ */
if (!pIOHandler)return true; if (!pIOHandler) {
return true;
}
const char* tokens[] = {"<collada"}; const char* tokens[] = {"<collada"};
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1); return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1);
} }
return false; return false;
} }
@ -147,8 +150,7 @@ const aiImporterDesc* ColladaLoader::GetInfo () const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) {
{
mFileName = pFile; mFileName = pFile;
// clean all member arrays - just for safety, it should work even if we did not // clean all member arrays - just for safety, it should work even if we did not
@ -184,7 +186,7 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
// ... then fill the materials with the now adjusted settings // ... then fill the materials with the now adjusted settings
FillMaterials(parser, pScene); FillMaterials(parser, pScene);
// Apply unitsize scale calculation // Apply unit-size scale calculation
pScene->mRootNode->mTransformation *= aiMatrix4x4(parser.mUnitSize, 0, 0, 0, pScene->mRootNode->mTransformation *= aiMatrix4x4(parser.mUnitSize, 0, 0, 0,
0, parser.mUnitSize, 0, 0, 0, parser.mUnitSize, 0, 0,
0, 0, parser.mUnitSize, 0, 0, 0, parser.mUnitSize, 0,
@ -1924,21 +1926,28 @@ const Collada::Node* ColladaLoader::FindNodeBySID( const Collada::Node* pNode, c
std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode) std::string ColladaLoader::FindNameForNode( const Collada::Node* pNode)
{ {
// If explicitly requested, just use the collada name. // If explicitly requested, just use the collada name.
if (useColladaName) { if (useColladaName)
return pNode->mName;
}
// Now setup the name of the assimp node. The collada name might not be
// unique, so we use the collada ID.
if (!pNode->mID.empty())
return pNode->mID;
else if (!pNode->mSID.empty())
return pNode->mSID;
else
{ {
// No need to worry. Unnamed nodes are no problem at all, except if (!pNode->mName.empty()) {
// if cameras or lights need to be assigned to them. return pNode->mName;
return format() << "$ColladaAutoName$_" << mNodeNameCounter++; } else {
return format() << "$ColladaAutoName$_" << mNodeNameCounter++;
}
}
else
{
// Now setup the name of the assimp node. The collada name might not be
// unique, so we use the collada ID.
if (!pNode->mID.empty())
return pNode->mID;
else if (!pNode->mSID.empty())
return pNode->mSID;
else
{
// No need to worry. Unnamed nodes are no problem at all, except
// if cameras or lights need to be assigned to them.
return format() << "$ColladaAutoName$_" << mNodeNameCounter++;
}
} }
} }

View File

@ -4,7 +4,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
@ -2362,7 +2362,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
if( expectedPointCount > 0 && indices.size() != expectedPointCount * numOffsets) { if( expectedPointCount > 0 && indices.size() != expectedPointCount * numOffsets) {
if (pPrimType == Prim_Lines) { if (pPrimType == Prim_Lines) {
// HACK: We just fix this number since SketchUp 15.3.331 writes the wrong 'count' for 'lines' // HACK: We just fix this number since SketchUp 15.3.331 writes the wrong 'count' for 'lines'
ReportWarning( "Expected different index count in <p> element, %d instead of %d.", indices.size(), expectedPointCount * numOffsets); ReportWarning( "Expected different index count in <p> element, %zu instead of %zu.", indices.size(), expectedPointCount * numOffsets);
pNumPrimitives = (indices.size() / numOffsets) / 2; pNumPrimitives = (indices.size() / numOffsets) / 2;
} else } else
ThrowException( "Expected different index count in <p> element."); ThrowException( "Expected different index count in <p> element.");

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -3,7 +3,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.
@ -83,7 +83,7 @@ namespace FBX {
// e_unknown_21 = 1 << 21, // e_unknown_21 = 1 << 21,
// e_unknown_22 = 1 << 22, // e_unknown_22 = 1 << 22,
// e_unknown_23 = 1 << 23, // e_unknown_23 = 1 << 23,
// e_flag_field_size_64_bit = 1 << 24, // Not sure what is // e_flag_field_size_64_bit = 1 << 24, // Not sure what is
// e_unknown_25 = 1 << 25, // e_unknown_25 = 1 << 25,
// e_unknown_26 = 1 << 26, // e_unknown_26 = 1 << 26,
// e_unknown_27 = 1 << 27, // e_unknown_27 = 1 << 27,
@ -276,8 +276,8 @@ void ReadData(const char*& sbegin_out, const char*& send_out, const char* input,
case 'f': case 'f':
case 'd': case 'd':
case 'l': case 'l':
case 'i': { case 'i':
case 'c': {
const uint32_t length = ReadWord(input, cursor, end); const uint32_t length = ReadWord(input, cursor, end);
const uint32_t encoding = ReadWord(input, cursor, end); const uint32_t encoding = ReadWord(input, cursor, end);
@ -298,6 +298,10 @@ void ReadData(const char*& sbegin_out, const char*& send_out, const char* input,
stride = 8; stride = 8;
break; break;
case 'c':
stride = 1;
break;
default: default:
ai_assert(false); ai_assert(false);
}; };

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.
@ -390,9 +390,18 @@ namespace Assimp {
out_camera->mAspect = cam.AspectWidth() / cam.AspectHeight(); out_camera->mAspect = cam.AspectWidth() / cam.AspectHeight();
//cameras are defined along positive x direction //cameras are defined along positive x direction
out_camera->mPosition = cam.Position(); /*out_camera->mPosition = cam.Position();
out_camera->mLookAt = (cam.InterestPosition() - out_camera->mPosition).Normalize(); out_camera->mLookAt = (cam.InterestPosition() - out_camera->mPosition).Normalize();
out_camera->mUp = cam.UpVector(); out_camera->mUp = cam.UpVector();*/
out_camera->mPosition = aiVector3D(0.0f);
out_camera->mLookAt = aiVector3D(1.0f, 0.0f, 0.0f);
out_camera->mUp = aiVector3D(0.0f, 1.0f, 0.0f);
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView());
out_camera->mClipPlaneNear = cam.NearPlane();
out_camera->mClipPlaneFar = cam.FarPlane();
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView()); out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView());
out_camera->mClipPlaneNear = cam.NearPlane(); out_camera->mClipPlaneNear = cam.NearPlane();
@ -870,10 +879,15 @@ namespace Assimp {
for (const Geometry* geo : geos) { for (const Geometry* geo : geos) {
const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*>(geo); const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*>(geo);
const LineGeometry* const line = dynamic_cast<const LineGeometry*>(geo);
if (mesh) { if (mesh) {
const std::vector<unsigned int>& indices = ConvertMesh(*mesh, model, node_global_transform, nd); const std::vector<unsigned int>& indices = ConvertMesh(*mesh, model, node_global_transform, nd);
std::copy(indices.begin(), indices.end(), std::back_inserter(meshes)); std::copy(indices.begin(), indices.end(), std::back_inserter(meshes));
} }
else if (line) {
const std::vector<unsigned int>& indices = ConvertLine(*line, model, node_global_transform, nd);
std::copy(indices.begin(), indices.end(), std::back_inserter(meshes));
}
else { else {
FBXImporter::LogWarn("ignoring unrecognized geometry: " + geo->Name()); FBXImporter::LogWarn("ignoring unrecognized geometry: " + geo->Name());
} }
@ -922,7 +936,52 @@ namespace Assimp {
return temp; return temp;
} }
aiMesh* FBXConverter::SetupEmptyMesh(const MeshGeometry& mesh, aiNode& nd) std::vector<unsigned int> FBXConverter::ConvertLine(const LineGeometry& line, const Model& model,
const aiMatrix4x4& node_global_transform, aiNode& nd)
{
std::vector<unsigned int> temp;
const std::vector<aiVector3D>& vertices = line.GetVertices();
const std::vector<int>& indices = line.GetIndices();
if (vertices.empty() || indices.empty()) {
FBXImporter::LogWarn("ignoring empty line: " + line.Name());
return temp;
}
aiMesh* const out_mesh = SetupEmptyMesh(line, nd);
out_mesh->mPrimitiveTypes |= aiPrimitiveType_LINE;
// copy vertices
out_mesh->mNumVertices = static_cast<unsigned int>(vertices.size());
out_mesh->mVertices = new aiVector3D[out_mesh->mNumVertices];
std::copy(vertices.begin(), vertices.end(), out_mesh->mVertices);
//Number of line segments (faces) is "Number of Points - Number of Endpoints"
//N.B.: Endpoints in FbxLine are denoted by negative indices.
//If such an Index is encountered, add 1 and multiply by -1 to get the real index.
unsigned int epcount = 0;
for (unsigned i = 0; i < indices.size(); i++)
{
if (indices[i] < 0) epcount++;
}
unsigned int pcount = indices.size();
unsigned int scount = out_mesh->mNumFaces = pcount - epcount;
aiFace* fac = out_mesh->mFaces = new aiFace[scount]();
for (unsigned int i = 0; i < pcount; ++i) {
if (indices[i] < 0) continue;
aiFace& f = *fac++;
f.mNumIndices = 2; //2 == aiPrimitiveType_LINE
f.mIndices = new unsigned int[2];
f.mIndices[0] = indices[i];
int segid = indices[(i + 1 == pcount ? 0 : i + 1)]; //If we have reached he last point, wrap around
f.mIndices[1] = (segid < 0 ? (segid + 1)*-1 : segid); //Convert EndPoint Index to normal Index
}
temp.push_back(static_cast<unsigned int>(meshes.size() - 1));
return temp;
}
aiMesh* FBXConverter::SetupEmptyMesh(const Geometry& mesh, aiNode& nd)
{ {
aiMesh* const out_mesh = new aiMesh(); aiMesh* const out_mesh = new aiMesh();
meshes.push_back(out_mesh); meshes.push_back(out_mesh);
@ -957,6 +1016,7 @@ namespace Assimp {
// copy vertices // copy vertices
out_mesh->mNumVertices = static_cast<unsigned int>(vertices.size()); out_mesh->mNumVertices = static_cast<unsigned int>(vertices.size());
out_mesh->mVertices = new aiVector3D[vertices.size()]; out_mesh->mVertices = new aiVector3D[vertices.size()];
std::copy(vertices.begin(), vertices.end(), out_mesh->mVertices); std::copy(vertices.begin(), vertices.end(), out_mesh->mVertices);
// generate dummy faces // generate dummy faces
@ -1100,7 +1160,7 @@ namespace Assimp {
} }
} }
} }
size_t numAnimMeshes = animMeshes.size(); const size_t numAnimMeshes = animMeshes.size();
if (numAnimMeshes > 0) { if (numAnimMeshes > 0) {
out_mesh->mNumAnimMeshes = static_cast<unsigned int>(numAnimMeshes); out_mesh->mNumAnimMeshes = static_cast<unsigned int>(numAnimMeshes);
out_mesh->mAnimMeshes = new aiAnimMesh*[numAnimMeshes]; out_mesh->mAnimMeshes = new aiAnimMesh*[numAnimMeshes];
@ -1240,8 +1300,7 @@ namespace Assimp {
unsigned int cursor = 0, in_cursor = 0; unsigned int cursor = 0, in_cursor = 0;
itf = faces.begin(); itf = faces.begin();
for (MatIndexArray::const_iterator it = mindices.begin(), for (MatIndexArray::const_iterator it = mindices.begin(), end = mindices.end(); it != end; ++it, ++itf)
end = mindices.end(); it != end; ++it, ++itf)
{ {
const unsigned int pcount = *itf; const unsigned int pcount = *itf;
if ((*it) != index) { if ((*it) != index) {
@ -1524,6 +1583,7 @@ namespace Assimp {
// shading stuff and colors // shading stuff and colors
SetShadingPropertiesCommon(out_mat, props); SetShadingPropertiesCommon(out_mat, props);
SetShadingPropertiesRaw( out_mat, props, material.Textures(), mesh );
// texture assignments // texture assignments
SetTextureProperties(out_mat, material.Textures(), mesh); SetTextureProperties(out_mat, material.Textures(), mesh);
@ -2022,6 +2082,180 @@ namespace Assimp {
const float DispFactor = PropertyGet<float>(props, "DisplacementFactor", ok); const float DispFactor = PropertyGet<float>(props, "DisplacementFactor", ok);
if (ok) { if (ok) {
out_mat->AddProperty(&DispFactor, 1, "$mat.displacementscaling", 0, 0); out_mat->AddProperty(&DispFactor, 1, "$mat.displacementscaling", 0, 0);
}
}
void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTable& props, const TextureMap& textures, const MeshGeometry* const mesh)
{
// Add all the unparsed properties with a "$raw." prefix
const std::string prefix = "$raw.";
for (const DirectPropertyMap::value_type& prop : props.GetUnparsedProperties()) {
std::string name = prefix + prop.first;
if (const TypedProperty<aiVector3D>* interpreted = prop.second->As<TypedProperty<aiVector3D> >())
{
out_mat->AddProperty(&interpreted->Value(), 1, name.c_str(), 0, 0);
}
else if (const TypedProperty<aiColor3D>* interpreted = prop.second->As<TypedProperty<aiColor3D> >())
{
out_mat->AddProperty(&interpreted->Value(), 1, name.c_str(), 0, 0);
}
else if (const TypedProperty<aiColor4D>* interpreted = prop.second->As<TypedProperty<aiColor4D> >())
{
out_mat->AddProperty(&interpreted->Value(), 1, name.c_str(), 0, 0);
}
else if (const TypedProperty<float>* interpreted = prop.second->As<TypedProperty<float> >())
{
out_mat->AddProperty(&interpreted->Value(), 1, name.c_str(), 0, 0);
}
else if (const TypedProperty<int>* interpreted = prop.second->As<TypedProperty<int> >())
{
out_mat->AddProperty(&interpreted->Value(), 1, name.c_str(), 0, 0);
}
else if (const TypedProperty<bool>* interpreted = prop.second->As<TypedProperty<bool> >())
{
int value = interpreted->Value() ? 1 : 0;
out_mat->AddProperty(&value, 1, name.c_str(), 0, 0);
}
else if (const TypedProperty<std::string>* interpreted = prop.second->As<TypedProperty<std::string> >())
{
const aiString value = aiString(interpreted->Value());
out_mat->AddProperty(&value, name.c_str(), 0, 0);
}
}
// Add the textures' properties
for (TextureMap::const_iterator it = textures.begin(); it != textures.end(); it++) {
std::string name = prefix + it->first;
const Texture* const tex = (*it).second;
if (tex != nullptr)
{
aiString path;
path.Set(tex->RelativeFilename());
const Video* media = tex->Media();
if (media != nullptr && media->ContentLength() > 0) {
unsigned int index;
VideoMap::const_iterator it = textures_converted.find(media);
if (it != textures_converted.end()) {
index = (*it).second;
}
else {
index = ConvertVideo(*media);
textures_converted[media] = index;
}
// setup texture reference string (copied from ColladaLoader::FindFilenameForEffectTexture)
path.data[0] = '*';
path.length = 1 + ASSIMP_itoa10(path.data + 1, MAXLEN - 1, index);
}
out_mat->AddProperty(&path, (name + "|file").c_str(), aiTextureType_UNKNOWN, 0);
aiUVTransform uvTrafo;
// XXX handle all kinds of UV transformations
uvTrafo.mScaling = tex->UVScaling();
uvTrafo.mTranslation = tex->UVTranslation();
out_mat->AddProperty(&uvTrafo, 1, (name + "|uvtrafo").c_str(), aiTextureType_UNKNOWN, 0);
int uvIndex = 0;
bool uvFound = false;
const std::string& uvSet = PropertyGet<std::string>(tex->Props(), "UVSet", uvFound);
if (uvFound) {
// "default" is the name which usually appears in the FbxFileTexture template
if (uvSet != "default" && uvSet.length()) {
// this is a bit awkward - we need to find a mesh that uses this
// material and scan its UV channels for the given UV name because
// assimp references UV channels by index, not by name.
// XXX: the case that UV channels may appear in different orders
// in meshes is unhandled. A possible solution would be to sort
// the UV channels alphabetically, but this would have the side
// effect that the primary (first) UV channel would sometimes
// be moved, causing trouble when users read only the first
// UV channel and ignore UV channel assignments altogether.
std::vector<aiMaterial*>::iterator materialIt = std::find(materials.begin(), materials.end(), out_mat);
const unsigned int matIndex = static_cast<unsigned int>(std::distance(materials.begin(), materialIt));
uvIndex = -1;
if (!mesh)
{
for (const MeshMap::value_type& v : meshes_converted) {
const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*>(v.first);
if (!mesh) {
continue;
}
const MatIndexArray& mats = mesh->GetMaterialIndices();
if (std::find(mats.begin(), mats.end(), matIndex) == mats.end()) {
continue;
}
int index = -1;
for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
if (mesh->GetTextureCoords(i).empty()) {
break;
}
const std::string& name = mesh->GetTextureCoordChannelName(i);
if (name == uvSet) {
index = static_cast<int>(i);
break;
}
}
if (index == -1) {
FBXImporter::LogWarn("did not find UV channel named " + uvSet + " in a mesh using this material");
continue;
}
if (uvIndex == -1) {
uvIndex = index;
}
else {
FBXImporter::LogWarn("the UV channel named " + uvSet + " appears at different positions in meshes, results will be wrong");
}
}
}
else
{
int index = -1;
for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
if (mesh->GetTextureCoords(i).empty()) {
break;
}
const std::string& name = mesh->GetTextureCoordChannelName(i);
if (name == uvSet) {
index = static_cast<int>(i);
break;
}
}
if (index == -1) {
FBXImporter::LogWarn("did not find UV channel named " + uvSet + " in a mesh using this material");
}
if (uvIndex == -1) {
uvIndex = index;
}
}
if (uvIndex == -1) {
FBXImporter::LogWarn("failed to resolve UV channel " + uvSet + ", using first UV channel");
uvIndex = 0;
}
}
}
out_mat->AddProperty(&uvIndex, 1, (name + "|uvwsrc").c_str(), aiTextureType_UNKNOWN, 0);
}
} }
} }

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.
@ -174,14 +174,18 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertModel(const Model& model, aiNode& nd, const aiMatrix4x4& node_global_transform); void ConvertModel(const Model& model, aiNode& nd, const aiMatrix4x4& node_global_transform);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// MeshGeometry -> aiMesh, return mesh index + 1 or 0 if the conversion failed // MeshGeometry -> aiMesh, return mesh index + 1 or 0 if the conversion failed
std::vector<unsigned int> ConvertMesh(const MeshGeometry& mesh, const Model& model, std::vector<unsigned int> ConvertMesh(const MeshGeometry& mesh, const Model& model,
const aiMatrix4x4& node_global_transform, aiNode& nd); const aiMatrix4x4& node_global_transform, aiNode& nd);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiMesh* SetupEmptyMesh(const MeshGeometry& mesh, aiNode& nd); std::vector<unsigned int> ConvertLine(const LineGeometry& line, const Model& model,
const aiMatrix4x4& node_global_transform, aiNode& nd);
// ------------------------------------------------------------------------------------------------
aiMesh* SetupEmptyMesh(const Geometry& mesh, aiNode& nd);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
unsigned int ConvertMeshSingleMaterial(const MeshGeometry& mesh, const Model& model, unsigned int ConvertMeshSingleMaterial(const MeshGeometry& mesh, const Model& model,
@ -264,6 +268,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SetShadingPropertiesCommon(aiMaterial* out_mat, const PropertyTable& props); void SetShadingPropertiesCommon(aiMaterial* out_mat, const PropertyTable& props);
void SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTable& props, const TextureMap& textures, const MeshGeometry* const mesh);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// get the number of fps for a FrameRate enumerated value // get the number of fps for a FrameRate enumerated value
@ -424,6 +429,7 @@ private:
std::vector<aiLight*> lights; std::vector<aiLight*> lights;
std::vector<aiCamera*> cameras; std::vector<aiCamera*> cameras;
std::vector<aiTexture*> textures; std::vector<aiTexture*> textures;
typedef std::map<const Material*, unsigned int> MaterialMap; typedef std::map<const Material*, unsigned int> MaterialMap;
MaterialMap materials_converted; MaterialMap materials_converted;

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.
@ -69,8 +69,7 @@ LazyObject::LazyObject(uint64_t id, const Element& element, const Document& doc)
: doc(doc) : doc(doc)
, element(element) , element(element)
, id(id) , id(id)
, flags() , flags() {
{
// empty // empty
} }
@ -84,7 +83,7 @@ LazyObject::~LazyObject()
const Object* LazyObject::Get(bool dieOnError) const Object* LazyObject::Get(bool dieOnError)
{ {
if(IsBeingConstructed() || FailedToConstruct()) { if(IsBeingConstructed() || FailedToConstruct()) {
return NULL; return nullptr;
} }
if (object.get()) { if (object.get()) {
@ -149,6 +148,9 @@ const Object* LazyObject::Get(bool dieOnError)
if (!strcmp(classtag.c_str(), "Shape")) { if (!strcmp(classtag.c_str(), "Shape")) {
object.reset(new ShapeGeometry(id, element, name, doc)); object.reset(new ShapeGeometry(id, element, name, doc));
} }
if (!strcmp(classtag.c_str(), "Line")) {
object.reset(new LineGeometry(id, element, name, doc));
}
} }
else if (!strncmp(obtype,"NodeAttribute",length)) { else if (!strncmp(obtype,"NodeAttribute",length)) {
if (!strcmp(classtag.c_str(),"Camera")) { if (!strcmp(classtag.c_str(),"Camera")) {
@ -550,7 +552,7 @@ const std::vector<const AnimationStack*>& Document::AnimationStacks() const
LazyObject* Document::GetObject(uint64_t id) const LazyObject* Document::GetObject(uint64_t id) const
{ {
ObjectMap::const_iterator it = objects.find(id); ObjectMap::const_iterator it = objects.find(id);
return it == objects.end() ? NULL : (*it).second; return it == objects.end() ? nullptr : (*it).second;
} }
#define MAX_CLASSNAMES 6 #define MAX_CLASSNAMES 6
@ -607,7 +609,7 @@ std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, bo
for (size_t i = 0; i < c; ++i) { for (size_t i = 0; i < c; ++i) {
ai_assert(classnames[i]); ai_assert(classnames[i]);
if(static_cast<size_t>(std::distance(key.begin(),key.end())) == lengths[i] && !strncmp(classnames[i],obtype,lengths[i])) { if(static_cast<size_t>(std::distance(key.begin(),key.end())) == lengths[i] && !strncmp(classnames[i],obtype,lengths[i])) {
obtype = NULL; obtype = nullptr;
break; break;
} }
} }

View File

@ -2,7 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team Copyright (c) 2006-2019, assimp team
All rights reserved. All rights reserved.
@ -66,6 +66,7 @@ class PropertyTable;
class Document; class Document;
class Material; class Material;
class ShapeGeometry; class ShapeGeometry;
class LineGeometry;
class Geometry; class Geometry;
class Video; class Video;
@ -84,13 +85,11 @@ class Cluster;
/** Represents a delay-parsed FBX objects. Many objects in the scene /** Represents a delay-parsed FBX objects. Many objects in the scene
* are not needed by assimp, so it makes no sense to parse them * are not needed by assimp, so it makes no sense to parse them
* upfront. */ * upfront. */
class LazyObject class LazyObject {
{
public: public:
LazyObject(uint64_t id, const Element& element, const Document& doc); LazyObject(uint64_t id, const Element& element, const Document& doc);
~LazyObject();
public: ~LazyObject();
const Object* Get(bool dieOnError = false); const Object* Get(bool dieOnError = false);
@ -135,11 +134,8 @@ private:
unsigned int flags; unsigned int flags;
}; };
/** Base class for in-memory (DOM) representations of FBX objects */ /** Base class for in-memory (DOM) representations of FBX objects */
class Object class Object {
{
public: public:
Object(uint64_t id, const Element& element, const std::string& name); Object(uint64_t id, const Element& element, const std::string& name);
@ -163,14 +159,12 @@ protected:
const uint64_t id; const uint64_t id;
}; };
/** DOM class for generic FBX NoteAttribute blocks. NoteAttribute's just hold a property table, /** DOM class for generic FBX NoteAttribute blocks. NoteAttribute's just hold a property table,
* fixed members are added by deriving classes. */ * fixed members are added by deriving classes. */
class NodeAttribute : public Object class NodeAttribute : public Object {
{
public: public:
NodeAttribute(uint64_t id, const Element& element, const Document& doc, const std::string& name); NodeAttribute(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~NodeAttribute(); virtual ~NodeAttribute();
const PropertyTable& Props() const { const PropertyTable& Props() const {
@ -182,12 +176,11 @@ private:
std::shared_ptr<const PropertyTable> props; std::shared_ptr<const PropertyTable> props;
}; };
/** DOM base class for FBX camera settings attached to a node */ /** DOM base class for FBX camera settings attached to a node */
class CameraSwitcher : public NodeAttribute class CameraSwitcher : public NodeAttribute {
{
public: public:
CameraSwitcher(uint64_t id, const Element& element, const Document& doc, const std::string& name); CameraSwitcher(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~CameraSwitcher(); virtual ~CameraSwitcher();
int CameraID() const { int CameraID() const {
@ -208,7 +201,6 @@ private:
std::string cameraIndexName; std::string cameraIndexName;
}; };
#define fbx_stringize(a) #a #define fbx_stringize(a) #a
#define fbx_simple_property(name, type, default_value) \ #define fbx_simple_property(name, type, default_value) \
@ -229,13 +221,12 @@ private:
/** DOM base class for FBX cameras attached to a node */ /** DOM base class for FBX cameras attached to a node */
class Camera : public NodeAttribute class Camera : public NodeAttribute {
{
public: public:
Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name); Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Camera(); virtual ~Camera();
public:
fbx_simple_property(Position, aiVector3D, aiVector3D(0,0,0)) fbx_simple_property(Position, aiVector3D, aiVector3D(0,0,0))
fbx_simple_property(UpVector, aiVector3D, aiVector3D(0,1,0)) fbx_simple_property(UpVector, aiVector3D, aiVector3D(0,1,0))
fbx_simple_property(InterestPosition, aiVector3D, aiVector3D(0,0,0)) fbx_simple_property(InterestPosition, aiVector3D, aiVector3D(0,0,0))
@ -255,33 +246,26 @@ public:
fbx_simple_property(FocalLength, float, 1.0f) fbx_simple_property(FocalLength, float, 1.0f)
}; };
/** DOM base class for FBX null markers attached to a node */ /** DOM base class for FBX null markers attached to a node */
class Null : public NodeAttribute class Null : public NodeAttribute {
{
public: public:
Null(uint64_t id, const Element& element, const Document& doc, const std::string& name); Null(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Null(); virtual ~Null();
}; };
/** DOM base class for FBX limb node markers attached to a node */ /** DOM base class for FBX limb node markers attached to a node */
class LimbNode : public NodeAttribute class LimbNode : public NodeAttribute {
{
public: public:
LimbNode(uint64_t id, const Element& element, const Document& doc, const std::string& name); LimbNode(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~LimbNode(); virtual ~LimbNode();
}; };
/** DOM base class for FBX lights attached to a node */ /** DOM base class for FBX lights attached to a node */
class Light : public NodeAttribute class Light : public NodeAttribute {
{
public: public:
Light(uint64_t id, const Element& element, const Document& doc, const std::string& name); Light(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Light(); virtual ~Light();
public:
enum Type enum Type
{ {
Type_Point, Type_Point,
@ -303,7 +287,6 @@ public:
Decay_MAX // end-of-enum sentinel Decay_MAX // end-of-enum sentinel
}; };
public:
fbx_simple_property(Color, aiVector3D, aiVector3D(1,1,1)) fbx_simple_property(Color, aiVector3D, aiVector3D(1,1,1))
fbx_simple_enum_property(LightType, Type, 0) fbx_simple_enum_property(LightType, Type, 0)
fbx_simple_property(CastLightOnObject, bool, false) fbx_simple_property(CastLightOnObject, bool, false)
@ -337,10 +320,8 @@ public:
fbx_simple_property(EnableBarnDoor, bool, true) fbx_simple_property(EnableBarnDoor, bool, true)
}; };
/** DOM base class for FBX models (even though its semantics are more "node" than "model" */ /** DOM base class for FBX models (even though its semantics are more "node" than "model" */
class Model : public Object class Model : public Object {
{
public: public:
enum RotOrder { enum RotOrder {
RotOrder_EulerXYZ = 0, RotOrder_EulerXYZ = 0,
@ -355,7 +336,6 @@ public:
RotOrder_MAX // end-of-enum sentinel RotOrder_MAX // end-of-enum sentinel
}; };
enum TransformInheritance { enum TransformInheritance {
TransformInheritance_RrSs = 0, TransformInheritance_RrSs = 0,
TransformInheritance_RSrs, TransformInheritance_RSrs,
@ -489,13 +469,12 @@ private:
}; };
/** DOM class for generic FBX textures */ /** DOM class for generic FBX textures */
class Texture : public Object class Texture : public Object {
{
public: public:
Texture(uint64_t id, const Element& element, const Document& doc, const std::string& name); Texture(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Texture(); virtual ~Texture();
public:
const std::string& Type() const { const std::string& Type() const {
return type; return type;
} }
@ -550,17 +529,15 @@ private:
}; };
/** DOM class for layered FBX textures */ /** DOM class for layered FBX textures */
class LayeredTexture : public Object class LayeredTexture : public Object {
{
public: public:
LayeredTexture(uint64_t id, const Element& element, const Document& doc, const std::string& name); LayeredTexture(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~LayeredTexture(); virtual ~LayeredTexture();
//Can only be called after construction of the layered texture object due to construction flag. // Can only be called after construction of the layered texture object due to construction flag.
void fillTexture(const Document& doc); void fillTexture(const Document& doc);
enum BlendMode enum BlendMode {
{
BlendMode_Translucent, BlendMode_Translucent,
BlendMode_Additive, BlendMode_Additive,
BlendMode_Modulate, BlendMode_Modulate,
@ -622,13 +599,12 @@ typedef std::fbx_unordered_map<std::string, const LayeredTexture*> LayeredTextur
/** DOM class for generic FBX videos */ /** DOM class for generic FBX videos */
class Video : public Object class Video : public Object {
{
public: public:
Video(uint64_t id, const Element& element, const Document& doc, const std::string& name); Video(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Video(); virtual ~Video();
public:
const std::string& Type() const { const std::string& Type() const {
return type; return type;
} }
@ -672,10 +648,10 @@ private:
}; };
/** DOM class for generic FBX materials */ /** DOM class for generic FBX materials */
class Material : public Object class Material : public Object {
{
public: public:
Material(uint64_t id, const Element& element, const Document& doc, const std::string& name); Material(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Material(); virtual ~Material();
const std::string& GetShadingModel() const { const std::string& GetShadingModel() const {
@ -712,8 +688,7 @@ typedef std::vector<int64_t> KeyTimeList;
typedef std::vector<float> KeyValueList; typedef std::vector<float> KeyValueList;
/** Represents a FBX animation curve (i.e. a 1-dimensional set of keyframes and values therefor) */ /** Represents a FBX animation curve (i.e. a 1-dimensional set of keyframes and values therefor) */
class AnimationCurve : public Object class AnimationCurve : public Object {
{
public: public:
AnimationCurve(uint64_t id, const Element& element, const std::string& name, const Document& doc); AnimationCurve(uint64_t id, const Element& element, const std::string& name, const Document& doc);
virtual ~AnimationCurve(); virtual ~AnimationCurve();
@ -724,14 +699,12 @@ public:
return keys; return keys;
} }
/** get list of keyframe values. /** get list of keyframe values.
* Invariant: |GetKeys()| == |GetValues()| && |GetKeys()| > 0*/ * Invariant: |GetKeys()| == |GetValues()| && |GetKeys()| > 0*/
const KeyValueList& GetValues() const { const KeyValueList& GetValues() const {
return values; return values;
} }
const std::vector<float>& GetAttributes() const { const std::vector<float>& GetAttributes() const {
return attributes; return attributes;
} }
@ -750,10 +723,8 @@ private:
// property-name -> animation curve // property-name -> animation curve
typedef std::map<std::string, const AnimationCurve*> AnimationCurveMap; typedef std::map<std::string, const AnimationCurve*> AnimationCurveMap;
/** Represents a FBX animation curve (i.e. a mapping from single animation curves to nodes) */ /** Represents a FBX animation curve (i.e. a mapping from single animation curves to nodes) */
class AnimationCurveNode : public Object class AnimationCurveNode : public Object {
{
public: public:
/* the optional white list specifies a list of property names for which the caller /* the optional white list specifies a list of property names for which the caller
wants animations for. If the curve node does not match one of these, std::range_error wants animations for. If the curve node does not match one of these, std::range_error
@ -803,8 +774,7 @@ private:
typedef std::vector<const AnimationCurveNode*> AnimationCurveNodeList; typedef std::vector<const AnimationCurveNode*> AnimationCurveNodeList;
/** Represents a FBX animation layer (i.e. a list of node animations) */ /** Represents a FBX animation layer (i.e. a list of node animations) */
class AnimationLayer : public Object class AnimationLayer : public Object {
{
public: public:
AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc); AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc);
virtual ~AnimationLayer(); virtual ~AnimationLayer();
@ -817,7 +787,7 @@ public:
/* the optional white list specifies a list of property names for which the caller /* the optional white list specifies a list of property names for which the caller
wants animations for. Curves not matching this list will not be added to the wants animations for. Curves not matching this list will not be added to the
animation layer. */ animation layer. */
AnimationCurveNodeList Nodes(const char* const * target_prop_whitelist = NULL, size_t whitelist_size = 0) const; AnimationCurveNodeList Nodes(const char* const * target_prop_whitelist = nullptr, size_t whitelist_size = 0) const;
private: private:
std::shared_ptr<const PropertyTable> props; std::shared_ptr<const PropertyTable> props;
@ -827,8 +797,7 @@ private:
typedef std::vector<const AnimationLayer*> AnimationLayerList; typedef std::vector<const AnimationLayer*> AnimationLayerList;
/** Represents a FBX animation stack (i.e. a list of animation layers) */ /** Represents a FBX animation stack (i.e. a list of animation layers) */
class AnimationStack : public Object class AnimationStack : public Object {
{
public: public:
AnimationStack(uint64_t id, const Element& element, const std::string& name, const Document& doc); AnimationStack(uint64_t id, const Element& element, const std::string& name, const Document& doc);
virtual ~AnimationStack(); virtual ~AnimationStack();
@ -854,8 +823,7 @@ private:
/** DOM class for deformers */ /** DOM class for deformers */
class Deformer : public Object class Deformer : public Object {
{
public: public:
Deformer(uint64_t id, const Element& element, const Document& doc, const std::string& name); Deformer(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Deformer(); virtual ~Deformer();
@ -874,10 +842,10 @@ typedef std::vector<unsigned int> WeightIndexArray;
/** DOM class for BlendShapeChannel deformers */ /** DOM class for BlendShapeChannel deformers */
class BlendShapeChannel : public Deformer class BlendShapeChannel : public Deformer {
{
public: public:
BlendShapeChannel(uint64_t id, const Element& element, const Document& doc, const std::string& name); BlendShapeChannel(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~BlendShapeChannel(); virtual ~BlendShapeChannel();
float DeformPercent() const { float DeformPercent() const {
@ -891,6 +859,7 @@ public:
const std::vector<const ShapeGeometry*>& GetShapeGeometries() const { const std::vector<const ShapeGeometry*>& GetShapeGeometries() const {
return shapeGeometries; return shapeGeometries;
} }
private: private:
float percent; float percent;
WeightArray fullWeights; WeightArray fullWeights;
@ -898,10 +867,10 @@ private:
}; };
/** DOM class for BlendShape deformers */ /** DOM class for BlendShape deformers */
class BlendShape : public Deformer class BlendShape : public Deformer {
{
public: public:
BlendShape(uint64_t id, const Element& element, const Document& doc, const std::string& name); BlendShape(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~BlendShape(); virtual ~BlendShape();
const std::vector<const BlendShapeChannel*>& BlendShapeChannels() const { const std::vector<const BlendShapeChannel*>& BlendShapeChannels() const {
@ -912,11 +881,11 @@ private:
std::vector<const BlendShapeChannel*> blendShapeChannels; std::vector<const BlendShapeChannel*> blendShapeChannels;
}; };
/** DOM class for skin deformer clusters (aka subdeformers) */ /** DOM class for skin deformer clusters (aka sub-deformers) */
class Cluster : public Deformer class Cluster : public Deformer {
{
public: public:
Cluster(uint64_t id, const Element& element, const Document& doc, const std::string& name); Cluster(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Cluster(); virtual ~Cluster();
/** get the list of deformer weights associated with this cluster. /** get the list of deformer weights associated with this cluster.
@ -957,10 +926,10 @@ private:
}; };
/** DOM class for skin deformers */ /** DOM class for skin deformers */
class Skin : public Deformer class Skin : public Deformer {
{
public: public:
Skin(uint64_t id, const Element& element, const Document& doc, const std::string& name); Skin(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Skin(); virtual ~Skin();
float DeformAccuracy() const { float DeformAccuracy() const {
@ -977,10 +946,10 @@ private:
}; };
/** Represents a link between two FBX objects. */ /** Represents a link between two FBX objects. */
class Connection class Connection {
{
public: public:
Connection(uint64_t insertionOrder, uint64_t src, uint64_t dest, const std::string& prop, const Document& doc); Connection(uint64_t insertionOrder, uint64_t src, uint64_t dest, const std::string& prop, const Document& doc);
~Connection(); ~Connection();
// note: a connection ensures that the source and dest objects exist, but // note: a connection ensures that the source and dest objects exist, but
@ -1005,7 +974,7 @@ public:
} }
int CompareTo(const Connection* c) const { int CompareTo(const Connection* c) const {
ai_assert( NULL != c ); ai_assert( nullptr != c );
// note: can't subtract because this would overflow uint64_t // note: can't subtract because this would overflow uint64_t
if(InsertionOrder() > c->InsertionOrder()) { if(InsertionOrder() > c->InsertionOrder()) {
@ -1018,7 +987,7 @@ public:
} }
bool Compare(const Connection* c) const { bool Compare(const Connection* c) const {
ai_assert( NULL != c ); ai_assert( nullptr != c );
return InsertionOrder() < c->InsertionOrder(); return InsertionOrder() < c->InsertionOrder();
} }
@ -1046,6 +1015,7 @@ typedef std::multimap<uint64_t, const Connection*> ConnectionMap;
class FileGlobalSettings { class FileGlobalSettings {
public: public:
FileGlobalSettings(const Document& doc, std::shared_ptr<const PropertyTable> props); FileGlobalSettings(const Document& doc, std::shared_ptr<const PropertyTable> props);
~FileGlobalSettings(); ~FileGlobalSettings();
const PropertyTable& Props() const { const PropertyTable& Props() const {
@ -1102,10 +1072,10 @@ private:
}; };
/** DOM root for a FBX file */ /** DOM root for a FBX file */
class Document class Document {
{
public: public:
Document(const Parser& parser, const ImportSettings& settings); Document(const Parser& parser, const ImportSettings& settings);
~Document(); ~Document();
LazyObject* GetObject(uint64_t id) const; LazyObject* GetObject(uint64_t id) const;

Some files were not shown because too many files have changed in this diff Show More