Merge branch 'master' into ClipperUpdate
commit
0ad714d4e6
|
@ -93,6 +93,8 @@ FBXConverter::FBXConverter(aiScene *out, const Document &doc, bool removeEmptyBo
|
||||||
mSceneOut(out),
|
mSceneOut(out),
|
||||||
doc(doc),
|
doc(doc),
|
||||||
mRemoveEmptyBones(removeEmptyBones) {
|
mRemoveEmptyBones(removeEmptyBones) {
|
||||||
|
|
||||||
|
|
||||||
// animations need to be converted first since this will
|
// animations need to be converted first since this will
|
||||||
// populate the node_anim_chain_bits map, which is needed
|
// populate the node_anim_chain_bits map, which is needed
|
||||||
// to determine which nodes need to be generated.
|
// to determine which nodes need to be generated.
|
||||||
|
@ -427,12 +429,26 @@ void FBXConverter::ConvertCamera(const Camera &cam, const std::string &orig_name
|
||||||
out_camera->mLookAt = aiVector3D(1.0f, 0.0f, 0.0f);
|
out_camera->mLookAt = aiVector3D(1.0f, 0.0f, 0.0f);
|
||||||
out_camera->mUp = aiVector3D(0.0f, 1.0f, 0.0f);
|
out_camera->mUp = aiVector3D(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView());
|
// NOTE: Some software (maya) does not put FieldOfView in FBX, so we compute
|
||||||
|
// mHorizontalFOV from FocalLength and FilmWidth with unit conversion.
|
||||||
|
|
||||||
out_camera->mClipPlaneNear = cam.NearPlane();
|
// TODO: This is not a complete solution for how FBX cameras can be stored.
|
||||||
out_camera->mClipPlaneFar = cam.FarPlane();
|
// TODO: Incorporate non-square pixel aspect ratio.
|
||||||
|
// TODO: FBX aperture mode might be storing vertical FOV in need of conversion with aspect ratio.
|
||||||
|
|
||||||
|
float fov_deg = cam.FieldOfView();
|
||||||
|
// If FOV not specified in file, compute using FilmWidth and FocalLength.
|
||||||
|
if (fov_deg == kFovUnknown) {
|
||||||
|
float film_width_inches = cam.FilmWidth();
|
||||||
|
float focal_length_mm = cam.FocalLength();
|
||||||
|
ASSIMP_LOG_VERBOSE_DEBUG("FBX FOV unspecified. Computing from FilmWidth (", film_width_inches, "inches) and FocalLength (", focal_length_mm, "mm).");
|
||||||
|
double half_fov_rad = std::atan2(film_width_inches * 25.4 * 0.5, focal_length_mm);
|
||||||
|
out_camera->mHorizontalFOV = static_cast<float>(half_fov_rad);
|
||||||
|
} else {
|
||||||
|
// FBX fov is full-view degrees. We want half-view radians.
|
||||||
|
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(fov_deg) * 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView());
|
|
||||||
out_camera->mClipPlaneNear = cam.NearPlane();
|
out_camera->mClipPlaneNear = cam.NearPlane();
|
||||||
out_camera->mClipPlaneFar = cam.FarPlane();
|
out_camera->mClipPlaneFar = cam.FarPlane();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define _AI_CONCAT(a,b) a ## b
|
#define _AI_CONCAT(a,b) a ## b
|
||||||
#define AI_CONCAT(a,b) _AI_CONCAT(a,b)
|
#define AI_CONCAT(a,b) _AI_CONCAT(a,b)
|
||||||
|
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
|
||||||
|
// Use an 'illegal' default FOV value to detect if the FBX camera has set the FOV.
|
||||||
|
static const float kFovUnknown = -1.0f;
|
||||||
|
|
||||||
|
|
||||||
class Parser;
|
class Parser;
|
||||||
class Object;
|
class Object;
|
||||||
struct ImportSettings;
|
struct ImportSettings;
|
||||||
|
@ -247,7 +252,7 @@ public:
|
||||||
fbx_simple_property(FilmAspectRatio, float, 1.0f)
|
fbx_simple_property(FilmAspectRatio, float, 1.0f)
|
||||||
fbx_simple_property(ApertureMode, int, 0)
|
fbx_simple_property(ApertureMode, int, 0)
|
||||||
|
|
||||||
fbx_simple_property(FieldOfView, float, 1.0f)
|
fbx_simple_property(FieldOfView, float, kFovUnknown)
|
||||||
fbx_simple_property(FocalLength, float, 1.0f)
|
fbx_simple_property(FocalLength, float, 1.0f)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ Scope::Scope(Parser& parser,bool topLevel)
|
||||||
elements.insert(ElementMap::value_type(str, element));
|
elements.insert(ElementMap::value_type(str, element));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
delete element;
|
delete_Element(element);
|
||||||
ParseError("unexpected end of file",parser.LastToken());
|
ParseError("unexpected end of file",parser.LastToken());
|
||||||
} else {
|
} else {
|
||||||
elements.insert(ElementMap::value_type(str, element));
|
elements.insert(ElementMap::value_type(str, element));
|
||||||
|
|
|
@ -271,10 +271,16 @@ void MDLImporter::InternReadFile(const std::string &pFile,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// Check whether we're still inside the valid file range
|
||||||
|
bool MDLImporter::IsPosValid(const void *szPos) const {
|
||||||
|
return szPos && (const unsigned char *)szPos <= this->mBuffer + this->iFileSize && szPos >= this->mBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Check whether we're still inside the valid file range
|
// Check whether we're still inside the valid file range
|
||||||
void MDLImporter::SizeCheck(const void *szPos) {
|
void MDLImporter::SizeCheck(const void *szPos) {
|
||||||
if (!szPos || (const unsigned char *)szPos > this->mBuffer + this->iFileSize || szPos < this->mBuffer) {
|
if (!IsPosValid(szPos)) {
|
||||||
throw DeadlyImportError("Invalid MDL file. The file is too small "
|
throw DeadlyImportError("Invalid MDL file. The file is too small "
|
||||||
"or contains invalid data.");
|
"or contains invalid data.");
|
||||||
}
|
}
|
||||||
|
@ -284,7 +290,7 @@ void MDLImporter::SizeCheck(const void *szPos) {
|
||||||
// Just for debugging purposes
|
// Just for debugging purposes
|
||||||
void MDLImporter::SizeCheck(const void *szPos, const char *szFile, unsigned int iLine) {
|
void MDLImporter::SizeCheck(const void *szPos, const char *szFile, unsigned int iLine) {
|
||||||
ai_assert(nullptr != szFile);
|
ai_assert(nullptr != szFile);
|
||||||
if (!szPos || (const unsigned char *)szPos > mBuffer + iFileSize) {
|
if (!IsPosValid(szPos)) {
|
||||||
// remove a directory if there is one
|
// remove a directory if there is one
|
||||||
const char *szFilePtr = ::strrchr(szFile, '\\');
|
const char *szFilePtr = ::strrchr(szFile, '\\');
|
||||||
if (!szFilePtr) {
|
if (!szFilePtr) {
|
||||||
|
|
|
@ -150,6 +150,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
void SizeCheck(const void* szPos);
|
void SizeCheck(const void* szPos);
|
||||||
void SizeCheck(const void* szPos, const char* szFile, unsigned int iLine);
|
void SizeCheck(const void* szPos, const char* szFile, unsigned int iLine);
|
||||||
|
bool IsPosValid(const void* szPos) const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Validate the header data structure of a game studio MDL7 file
|
/** Validate the header data structure of a game studio MDL7 file
|
||||||
|
|
|
@ -52,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include <assimp/StreamReader.h>
|
#include <assimp/StreamReader.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
@ -160,6 +161,9 @@ void NDOImporter::InternReadFile( const std::string& pFile,
|
||||||
|
|
||||||
temp = file_format >= 12 ? reader.GetU4() : reader.GetU2();
|
temp = file_format >= 12 ? reader.GetU4() : reader.GetU2();
|
||||||
head = (const char*)reader.GetPtr();
|
head = (const char*)reader.GetPtr();
|
||||||
|
if (std::numeric_limits<unsigned int>::max() - 76 < temp) {
|
||||||
|
throw DeadlyImportError("Invalid name length");
|
||||||
|
}
|
||||||
reader.IncPtr(temp + 76); /* skip unknown stuff */
|
reader.IncPtr(temp + 76); /* skip unknown stuff */
|
||||||
|
|
||||||
obj.name = std::string(head, temp);
|
obj.name = std::string(head, temp);
|
||||||
|
|
|
@ -45,6 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/StringUtils.h>
|
#include <assimp/StringUtils.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/Base64.hpp>
|
#include <assimp/Base64.hpp>
|
||||||
|
#include <rapidjson/document.h>
|
||||||
|
#include <rapidjson/schema.h>
|
||||||
|
#include <rapidjson/stringbuffer.h>
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#ifdef ASSIMP_ENABLE_DRACO
|
#ifdef ASSIMP_ENABLE_DRACO
|
||||||
|
|
|
@ -234,7 +234,8 @@ inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset
|
||||||
SetMaterialTextureProperty(embeddedTexIdxs, r, (glTF2::TextureInfo)prop, mat, texType, texSlot);
|
SetMaterialTextureProperty(embeddedTexIdxs, r, (glTF2::TextureInfo)prop, mat, texType, texSlot);
|
||||||
|
|
||||||
if (prop.texture && prop.texture->source) {
|
if (prop.texture && prop.texture->source) {
|
||||||
mat->AddProperty(&prop.strength, 1, AI_MATKEY_GLTF_TEXTURE_STRENGTH(texType, texSlot));
|
std::string textureStrengthKey = std::string(_AI_MATKEY_TEXTURE_BASE) + "." + "strength";
|
||||||
|
mat->AddProperty(&prop.strength, 1, textureStrengthKey.c_str(), texType, texSlot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1418,25 +1418,29 @@ if(MSVC AND ASSIMP_INSTALL_PDB)
|
||||||
COMPILE_PDB_NAME assimp${LIBRARY_SUFFIX}
|
COMPILE_PDB_NAME assimp${LIBRARY_SUFFIX}
|
||||||
COMPILE_PDB_NAME_DEBUG assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}
|
COMPILE_PDB_NAME_DEBUG assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}
|
||||||
)
|
)
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
|
IF(GENERATOR_IS_MULTI_CONFIG)
|
||||||
install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb
|
install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb
|
||||||
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||||
CONFIGURATIONS Debug
|
CONFIGURATIONS Debug
|
||||||
)
|
)
|
||||||
install(FILES ${Assimp_BINARY_DIR}/code/RelWithDebInfo/assimp${LIBRARY_SUFFIX}.pdb
|
install(FILES ${Assimp_BINARY_DIR}/code/RelWithDebInfo/assimp${LIBRARY_SUFFIX}.pdb
|
||||||
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||||
CONFIGURATIONS RelWithDebInfo
|
CONFIGURATIONS RelWithDebInfo
|
||||||
)
|
)
|
||||||
|
ELSE()
|
||||||
|
install(FILES ${Assimp_BINARY_DIR}/code/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb
|
||||||
|
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||||
|
CONFIGURATIONS Debug
|
||||||
|
)
|
||||||
|
install(FILES ${Assimp_BINARY_DIR}/code/assimp${LIBRARY_SUFFIX}.pdb
|
||||||
|
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||||
|
CONFIGURATIONS RelWithDebInfo
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
ELSE()
|
ELSE()
|
||||||
install(FILES ${Assimp_BINARY_DIR}/code/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb
|
install(FILES $<TARGET_PDB_FILE:assimp>
|
||||||
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
||||||
CONFIGURATIONS Debug
|
|
||||||
)
|
|
||||||
install(FILES ${Assimp_BINARY_DIR}/code/assimp${LIBRARY_SUFFIX}.pdb
|
|
||||||
DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
|
||||||
CONFIGURATIONS RelWithDebInfo
|
|
||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
|
@ -312,12 +312,7 @@ std::string BaseImporter::GetExtension(const std::string &pFile) {
|
||||||
if (!pIOHandler) {
|
if (!pIOHandler) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
union {
|
const char *magic = reinterpret_cast<const char *>(_magic);
|
||||||
const char *magic;
|
|
||||||
const uint16_t *magic_u16;
|
|
||||||
const uint32_t *magic_u32;
|
|
||||||
};
|
|
||||||
magic = reinterpret_cast<const char *>(_magic);
|
|
||||||
std::unique_ptr<IOStream> pStream(pIOHandler->Open(pFile));
|
std::unique_ptr<IOStream> pStream(pIOHandler->Open(pFile));
|
||||||
if (pStream) {
|
if (pStream) {
|
||||||
|
|
||||||
|
@ -339,15 +334,15 @@ std::string BaseImporter::GetExtension(const std::string &pFile) {
|
||||||
// that's just for convenience, the chance that we cause conflicts
|
// that's just for convenience, the chance that we cause conflicts
|
||||||
// is quite low and it can save some lines and prevent nasty bugs
|
// is quite low and it can save some lines and prevent nasty bugs
|
||||||
if (2 == size) {
|
if (2 == size) {
|
||||||
uint16_t rev = *magic_u16;
|
uint16_t magic_u16;
|
||||||
ByteSwap::Swap(&rev);
|
memcpy(&magic_u16, magic, 2);
|
||||||
if (data_u16[0] == *magic_u16 || data_u16[0] == rev) {
|
if (data_u16[0] == magic_u16 || data_u16[0] == ByteSwap::Swapped(magic_u16)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (4 == size) {
|
} else if (4 == size) {
|
||||||
uint32_t rev = *magic_u32;
|
uint32_t magic_u32;
|
||||||
ByteSwap::Swap(&rev);
|
memcpy(&magic_u32, magic, 4);
|
||||||
if (data_u32[0] == *magic_u32 || data_u32[0] == rev) {
|
if (data_u32[0] == magic_u32 || data_u32[0] == ByteSwap::Swapped(magic_u32)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,9 +15,11 @@ option( DDL_STATIC_LIBRARY "Deprecated, use BUILD_SHARED_LIBS instead."
|
||||||
# for backwards compatibility use DDL_STATIC_LIBRARY as initial value for cmake variable BUILD_SHARED_LIBS
|
# for backwards compatibility use DDL_STATIC_LIBRARY as initial value for cmake variable BUILD_SHARED_LIBS
|
||||||
# https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html
|
# https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html
|
||||||
if ( DDL_STATIC_LIBRARY )
|
if ( DDL_STATIC_LIBRARY )
|
||||||
set ( build_shared_libs_default OFF )
|
message("Building shared lib.")
|
||||||
|
set ( build_shared_libs_default OFF )
|
||||||
else()
|
else()
|
||||||
set ( build_shared_libs_default ON )
|
message("Building static lib.")
|
||||||
|
set ( build_shared_libs_default ON )
|
||||||
endif()
|
endif()
|
||||||
option( DDL_BUILD_SHARED_LIBS "Set to ON to build shared libary of OpenDDL Parser." ${build_shared_libs_default} )
|
option( DDL_BUILD_SHARED_LIBS "Set to ON to build shared libary of OpenDDL Parser." ${build_shared_libs_default} )
|
||||||
option( COVERALLS "Generate coveralls data" OFF )
|
option( COVERALLS "Generate coveralls data" OFF )
|
||||||
|
@ -36,6 +38,7 @@ endif()
|
||||||
add_definitions( -D_VARIADIC_MAX=10 )
|
add_definitions( -D_VARIADIC_MAX=10 )
|
||||||
add_definitions( -DGTEST_HAS_PTHREAD=0 )
|
add_definitions( -DGTEST_HAS_PTHREAD=0 )
|
||||||
if ( DDL_DEBUG_OUTPUT )
|
if ( DDL_DEBUG_OUTPUT )
|
||||||
|
message("Enable debug output.")
|
||||||
add_definitions( -DDDL_DEBUG_HEADER_NAME)
|
add_definitions( -DDDL_DEBUG_HEADER_NAME)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -62,10 +65,12 @@ if (COVERALLS)
|
||||||
include(Coveralls)
|
include(Coveralls)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||||
|
message("Enable coveralls.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Include the doc component.
|
# Include the doc component.
|
||||||
if(DDL_DOCUMENTATION)
|
if(DDL_DOCUMENTATION)
|
||||||
|
message("Generate doxygen documentation.")
|
||||||
find_package(Doxygen REQUIRED)
|
find_package(Doxygen REQUIRED)
|
||||||
CONFIGURE_FILE( doc/openddlparser_doc.in doc/doxygenfile @ONLY )
|
CONFIGURE_FILE( doc/openddlparser_doc.in doc/doxygenfile @ONLY )
|
||||||
add_custom_target(doc ALL
|
add_custom_target(doc ALL
|
||||||
|
|
|
@ -5,13 +5,15 @@ The OpenDDL-Parser is a small and easy to use library for OpenDDL-file-format-pa
|
||||||
|
|
||||||
Build status
|
Build status
|
||||||
============
|
============
|
||||||
Linux build status: [](https://travis-ci.org/kimkulling/openddl-parser)
|
|
||||||
|
Linux build status: [](https://travis-ci.com/kimkulling/openddl-parser)
|
||||||
Current coverity check status:
|
Current coverity check status:
|
||||||
<a href="https://scan.coverity.com/projects/5606">
|
<a href="https://scan.coverity.com/projects/5606">
|
||||||
<img alt="Coverity Scan Build Status"
|
<img alt="Coverity Scan Build Status"
|
||||||
src="https://scan.coverity.com/projects/5606/badge.svg"/>
|
src="https://scan.coverity.com/projects/5606/badge.svg"/>
|
||||||
</a>
|
</a>
|
||||||
Current test coverage:[](https://coveralls.io/github/kimkulling/openddl-parser?branch=cpp_coveralls)
|
Current test coverage:[](https://coveralls.io/github/kimkulling/openddl-parser?branch=cpp_coveralls)
|
||||||
|
|
||||||
Get the source code
|
Get the source code
|
||||||
===================
|
===================
|
||||||
You can get the code from our git repository, which is located at GitHub. You can clone the repository with the following command:
|
You can get the code from our git repository, which is located at GitHub. You can clone the repository with the following command:
|
||||||
|
@ -57,11 +59,11 @@ USE_ODDLPARSER_NS;
|
||||||
|
|
||||||
int main( int argc, char *argv[] ) {
|
int main( int argc, char *argv[] ) {
|
||||||
if( argc < 3 ) {
|
if( argc < 3 ) {
|
||||||
return 1;
|
return Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *filename( nullptr );
|
char *filename( nullptr );
|
||||||
if( 0 == strncmp( FileOption, argv[ 1 ], strlen( FileOption ) ) ) {
|
if( 0 == strncmp( FileOption, argv[1], strlen( FileOption ) ) ) {
|
||||||
filename = argv[ 2 ];
|
filename = argv[ 2 ];
|
||||||
}
|
}
|
||||||
std::cout << "file to import: " << filename << std::endl;
|
std::cout << "file to import: " << filename << std::endl;
|
||||||
|
@ -73,24 +75,27 @@ int main( int argc, char *argv[] ) {
|
||||||
FILE *fileStream = fopen( filename, "r+" );
|
FILE *fileStream = fopen( filename, "r+" );
|
||||||
if( NULL == filename ) {
|
if( NULL == filename ) {
|
||||||
std::cerr << "Cannot open file " << filename << std::endl;
|
std::cerr << "Cannot open file " << filename << std::endl;
|
||||||
return 1;
|
return Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// obtain file size:
|
// obtain file size:
|
||||||
fseek( fileStream, 0, SEEK_END );
|
fseek( fileStream, 0, SEEK_END );
|
||||||
const size_t size( ftell( fileStream ) );
|
const size_t size = ftell( fileStream );
|
||||||
rewind( fileStream );
|
rewind( fileStream );
|
||||||
if( size > 0 ) {
|
if( size > 0 ) {
|
||||||
char *buffer = new char[ size ];
|
char *buffer = new char[ size ];
|
||||||
const size_t readSize( fread( buffer, sizeof( char ), size, fileStream ) );
|
const size_t readSize = fread( buffer, sizeof( char ), size, fileStream );
|
||||||
assert( readSize == size );
|
assert( readSize == size );
|
||||||
|
|
||||||
|
// Set the memory buffer
|
||||||
OpenDDLParser theParser;
|
OpenDDLParser theParser;
|
||||||
theParser.setBuffer( buffer, size );
|
theParser.setBuffer( buffer, size );
|
||||||
const bool result( theParser.parse() );
|
if( !theParser.parse() ) {
|
||||||
if( !result ) {
|
|
||||||
std::cerr << "Error while parsing file " << filename << "." << std::endl;
|
std::cerr << "Error while parsing file " << filename << "." << std::endl;
|
||||||
|
return Error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,9 +111,9 @@ theParser.setBuffer( buffer, size );
|
||||||
const bool result( theParser.parse() );
|
const bool result( theParser.parse() );
|
||||||
if ( result ) {
|
if ( result ) {
|
||||||
DDLNode *root = theParser.getRoot();
|
DDLNode *root = theParser.getRoot();
|
||||||
DDLNode::DllNodeList childs = root->getChildNodeList();
|
DDLNode::DllNodeList children = root->getChildNodeList();
|
||||||
for ( size_t i=0; i<childs.size(); i++ ) {
|
for ( size_t i=0; i<children.size(); i++ ) {
|
||||||
DDLNode *child = childs[ i ];
|
DDLNode *child = children[ i ];
|
||||||
Property *prop = child->getProperty(); // to get properties
|
Property *prop = child->getProperty(); // to get properties
|
||||||
std::string type = child->getType(); // to get the node type
|
std::string type = child->getType(); // to get the node type
|
||||||
Value *values = child->getValue(); // to get the data;
|
Value *values = child->getValue(); // to get the data;
|
||||||
|
|
|
@ -30,7 +30,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
# ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# endif
|
||||||
|
# include <windows.h>
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
BEGIN_ODDLPARSER_NS
|
BEGIN_ODDLPARSER_NS
|
||||||
|
@ -71,7 +74,7 @@ const char *getTypeToken(Value::ValueType type) {
|
||||||
return Grammar::PrimitiveTypeToken[(size_t)type];
|
return Grammar::PrimitiveTypeToken[(size_t)type];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void logInvalidTokenError(char *in, const std::string &exp, OpenDDLParser::logCallback callback) {
|
static void logInvalidTokenError(const char *in, const std::string &exp, OpenDDLParser::logCallback callback) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
std::string full(in);
|
std::string full(in);
|
||||||
std::string part(full.substr(0, 50));
|
std::string part(full.substr(0, 50));
|
||||||
|
@ -338,20 +341,25 @@ char *OpenDDLParser::parseStructure(char *in, char *end) {
|
||||||
|
|
||||||
bool error(false);
|
bool error(false);
|
||||||
in = lookForNextToken(in, end);
|
in = lookForNextToken(in, end);
|
||||||
if (*in == *Grammar::OpenBracketToken) {
|
if (in != end) {
|
||||||
// loop over all children ( data and nodes )
|
if (*in == *Grammar::OpenBracketToken) {
|
||||||
do {
|
// loop over all children ( data and nodes )
|
||||||
in = parseStructureBody(in, end, error);
|
do {
|
||||||
if (in == nullptr) {
|
in = parseStructureBody(in, end, error);
|
||||||
return nullptr;
|
if (in == nullptr) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
} while (in != end &&
|
||||||
|
*in != *Grammar::CloseBracketToken);
|
||||||
|
if (in != end) {
|
||||||
|
++in;
|
||||||
}
|
}
|
||||||
} while (*in != *Grammar::CloseBracketToken);
|
} else {
|
||||||
++in;
|
++in;
|
||||||
} else {
|
logInvalidTokenError(in, std::string(Grammar::OpenBracketToken), m_logCallback);
|
||||||
++in;
|
error = true;
|
||||||
logInvalidTokenError(in, std::string(Grammar::OpenBracketToken), m_logCallback);
|
return nullptr;
|
||||||
error = true;
|
}
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
in = lookForNextToken(in, end);
|
in = lookForNextToken(in, end);
|
||||||
|
|
||||||
|
@ -418,8 +426,8 @@ char *OpenDDLParser::parseStructureBody(char *in, char *end, bool &error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
in = lookForNextToken(in, end);
|
in = lookForNextToken(in, end);
|
||||||
if (*in != '}') {
|
if (in == end || *in != '}') {
|
||||||
logInvalidTokenError(in, std::string(Grammar::CloseBracketToken), m_logCallback);
|
logInvalidTokenError(in == end ? "" : in, std::string(Grammar::CloseBracketToken), m_logCallback);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
//in++;
|
//in++;
|
||||||
|
@ -455,7 +463,7 @@ DDLNode *OpenDDLParser::top() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DDLNode *top(m_stack.back());
|
DDLNode *top = m_stack.back();
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,12 +655,15 @@ char *OpenDDLParser::parseBooleanLiteral(char *in, char *end, Value **boolean) {
|
||||||
|
|
||||||
in = lookForNextToken(in, end);
|
in = lookForNextToken(in, end);
|
||||||
char *start(in);
|
char *start(in);
|
||||||
|
|
||||||
|
size_t len(0);
|
||||||
while (!isSeparator(*in) && in != end) {
|
while (!isSeparator(*in) && in != end) {
|
||||||
++in;
|
++in;
|
||||||
|
++len;
|
||||||
}
|
}
|
||||||
int res = ::strncmp(Grammar::BoolTrue, start, strlen(Grammar::BoolTrue));
|
int res = ::strncmp(Grammar::BoolTrue, start, len);
|
||||||
if (0 != res) {
|
if (0 != res) {
|
||||||
res = ::strncmp(Grammar::BoolFalse, start, strlen(Grammar::BoolFalse));
|
res = ::strncmp(Grammar::BoolFalse, start, len);
|
||||||
if (0 != res) {
|
if (0 != res) {
|
||||||
*boolean = nullptr;
|
*boolean = nullptr;
|
||||||
return in;
|
return in;
|
||||||
|
@ -733,7 +744,7 @@ char *OpenDDLParser::parseFloatingLiteral(char *in, char *end, Value **floating,
|
||||||
|
|
||||||
in = lookForNextToken(in, end);
|
in = lookForNextToken(in, end);
|
||||||
char *start(in);
|
char *start(in);
|
||||||
while (!isSeparator(*in) && in != end) {
|
while (in != end && !isSeparator(*in)) {
|
||||||
++in;
|
++in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -838,6 +849,13 @@ char *OpenDDLParser::parseHexaLiteral(char *in, char *end, Value **data) {
|
||||||
int value(0);
|
int value(0);
|
||||||
while (pos > 0) {
|
while (pos > 0) {
|
||||||
int v = hex2Decimal(*start);
|
int v = hex2Decimal(*start);
|
||||||
|
if (v < 0) {
|
||||||
|
while (isEndofLine(*in)) {
|
||||||
|
++in;
|
||||||
|
}
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
--pos;
|
--pos;
|
||||||
value = (value << 4) | v;
|
value = (value << 4) | v;
|
||||||
++start;
|
++start;
|
||||||
|
@ -901,10 +919,10 @@ char *OpenDDLParser::parseDataList(char *in, char *end, Value::ValueType type, V
|
||||||
}
|
}
|
||||||
|
|
||||||
in = lookForNextToken(in, end);
|
in = lookForNextToken(in, end);
|
||||||
if (*in == '{') {
|
if (in != end && *in == '{') {
|
||||||
++in;
|
++in;
|
||||||
Value *current(nullptr), *prev(nullptr);
|
Value *current(nullptr), *prev(nullptr);
|
||||||
while ('}' != *in) {
|
while (in != end && '}' != *in) {
|
||||||
current = nullptr;
|
current = nullptr;
|
||||||
in = lookForNextToken(in, end);
|
in = lookForNextToken(in, end);
|
||||||
if (Value::ValueType::ddl_ref == type) {
|
if (Value::ValueType::ddl_ref == type) {
|
||||||
|
@ -962,11 +980,12 @@ char *OpenDDLParser::parseDataList(char *in, char *end, Value::ValueType type, V
|
||||||
}
|
}
|
||||||
|
|
||||||
in = getNextSeparator(in, end);
|
in = getNextSeparator(in, end);
|
||||||
if (',' != *in && Grammar::CloseBracketToken[0] != *in && !isSpace(*in)) {
|
if (in == end || (',' != *in && Grammar::CloseBracketToken[0] != *in && !isSpace(*in))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++in;
|
if (in != end)
|
||||||
|
++in;
|
||||||
}
|
}
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
|
|
|
@ -26,8 +26,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,15 +40,6 @@ struct Identifier;
|
||||||
struct Reference;
|
struct Reference;
|
||||||
struct Property;
|
struct Property;
|
||||||
|
|
||||||
template <class T>
|
|
||||||
inline bool isEmbeddedCommentOpenTag(T *in, T *end) {
|
|
||||||
if (in == '/' && in + 1 == '*') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief Utility function to search for the next token or the end of the buffer.
|
/// @brief Utility function to search for the next token or the end of the buffer.
|
||||||
/// @param in [in] The start position in the buffer.
|
/// @param in [in] The start position in the buffer.
|
||||||
/// @param end [in] The end position in the buffer.
|
/// @param end [in] The end position in the buffer.
|
||||||
|
|
|
@ -54,7 +54,9 @@ inline bool isSeparator(T in) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const unsigned char chartype_table[256] = {
|
const size_t CharTableSize = 256;
|
||||||
|
|
||||||
|
static const unsigned char chartype_table[CharTableSize] = {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -318,6 +320,10 @@ static const unsigned char chartype_table[256] = {
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline bool isNumeric(const T in) {
|
inline bool isNumeric(const T in) {
|
||||||
|
if (static_cast<size_t>(in) >= CharTableSize) {
|
||||||
|
return '\0';
|
||||||
|
}
|
||||||
|
|
||||||
size_t idx = static_cast<size_t>(in);
|
size_t idx = static_cast<size_t>(in);
|
||||||
return idx < sizeof(chartype_table) && (chartype_table[idx] == 1);
|
return idx < sizeof(chartype_table) && (chartype_table[idx] == 1);
|
||||||
}
|
}
|
||||||
|
@ -433,7 +439,7 @@ inline bool isEndofLine(const T in) {
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline static T *getNextSeparator(T *in, T *end) {
|
inline static T *getNextSeparator(T *in, T *end) {
|
||||||
while (!isSeparator(*in) || in == end) {
|
while (in != end && !isSeparator(*in)) {
|
||||||
++in;
|
++in;
|
||||||
}
|
}
|
||||||
return in;
|
return in;
|
||||||
|
|
|
@ -94,6 +94,7 @@ enum aiPostProcessSteps
|
||||||
* indexed geometry, this step is compulsory or you'll just waste rendering
|
* indexed geometry, this step is compulsory or you'll just waste rendering
|
||||||
* time. <b>If this flag is not specified</b>, no vertices are referenced by
|
* time. <b>If this flag is not specified</b>, no vertices are referenced by
|
||||||
* more than one face and <b>no index buffer is required</b> for rendering.
|
* more than one face and <b>no index buffer is required</b> for rendering.
|
||||||
|
* Unless the importer (like ply) had to split vertices. Then you need one regardless.
|
||||||
*/
|
*/
|
||||||
aiProcess_JoinIdenticalVertices = 0x2,
|
aiProcess_JoinIdenticalVertices = 0x2,
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
The interface files are by no means complete yet and only work with the not-yet-released D SWIG backend, although adding support for other languages should not be too much of problem via #ifdefs.
|
|
|
@ -1,140 +0,0 @@
|
||||||
%module assimp
|
|
||||||
|
|
||||||
// SWIG helpers for std::string and std::vector wrapping.
|
|
||||||
%include <std_string.i>
|
|
||||||
%include <std_vector.i>
|
|
||||||
|
|
||||||
// Globally enable enum prefix stripping.
|
|
||||||
%dstripprefix;
|
|
||||||
|
|
||||||
|
|
||||||
// PACK_STRUCT is a no-op for SWIG – it does not matter for the generated
|
|
||||||
// bindings how the underlying C++ code manages its memory.
|
|
||||||
#define PACK_STRUCT
|
|
||||||
|
|
||||||
|
|
||||||
// Helper macros for wrapping the pointer-and-length arrays used in the
|
|
||||||
// Assimp API.
|
|
||||||
|
|
||||||
%define ASSIMP_ARRAY(CLASS, TYPE, NAME, LENGTH)
|
|
||||||
%newobject CLASS::NAME;
|
|
||||||
%extend CLASS {
|
|
||||||
std::vector<TYPE > *NAME() const {
|
|
||||||
std::vector<TYPE > *result = new std::vector<TYPE >;
|
|
||||||
result->reserve(LENGTH);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < LENGTH; ++i) {
|
|
||||||
result->push_back($self->NAME[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
%ignore CLASS::NAME;
|
|
||||||
%enddef
|
|
||||||
|
|
||||||
%define ASSIMP_POINTER_ARRAY(CLASS, TYPE, NAME, LENGTH)
|
|
||||||
%newobject CLASS::NAME;
|
|
||||||
%extend CLASS {
|
|
||||||
std::vector<TYPE *> *NAME() const {
|
|
||||||
std::vector<TYPE *> *result = new std::vector<TYPE *>;
|
|
||||||
result->reserve(LENGTH);
|
|
||||||
|
|
||||||
TYPE *currentValue = $self->NAME;
|
|
||||||
TYPE *valueLimit = $self->NAME + LENGTH;
|
|
||||||
while (currentValue < valueLimit) {
|
|
||||||
result->push_back(currentValue);
|
|
||||||
++currentValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
%ignore CLASS::NAME;
|
|
||||||
%enddef
|
|
||||||
|
|
||||||
%define ASSIMP_POINTER_ARRAY_ARRAY(CLASS, TYPE, NAME, OUTER_LENGTH, INNER_LENGTH)
|
|
||||||
%newobject CLASS::NAME;
|
|
||||||
%extend CLASS {
|
|
||||||
std::vector<std::vector<TYPE *> > *NAME() const {
|
|
||||||
std::vector<std::vector<TYPE *> > *result = new std::vector<std::vector<TYPE *> >;
|
|
||||||
result->reserve(OUTER_LENGTH);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < OUTER_LENGTH; ++i) {
|
|
||||||
std::vector<TYPE *> currentElements;
|
|
||||||
|
|
||||||
if ($self->NAME[i] != 0) {
|
|
||||||
currentElements.reserve(INNER_LENGTH);
|
|
||||||
|
|
||||||
TYPE *currentValue = $self->NAME[i];
|
|
||||||
TYPE *valueLimit = $self->NAME[i] + INNER_LENGTH;
|
|
||||||
while (currentValue < valueLimit) {
|
|
||||||
currentElements.push_back(currentValue);
|
|
||||||
++currentValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result->push_back(currentElements);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
%ignore CLASS::NAME;
|
|
||||||
%enddef
|
|
||||||
|
|
||||||
|
|
||||||
%include "interface/aiDefines.i"
|
|
||||||
%include "interface/aiTypes.i"
|
|
||||||
%include "interface/assimp.i"
|
|
||||||
%include "interface/aiTexture.i"
|
|
||||||
%include "interface/aiMatrix4x4.i"
|
|
||||||
%include "interface/aiMatrix3x3.i"
|
|
||||||
%include "interface/aiVector3D.i"
|
|
||||||
%include "interface/aiVector2D.i"
|
|
||||||
%include "interface/aiColor4D.i"
|
|
||||||
%include "interface/aiLight.i"
|
|
||||||
%include "interface/aiCamera.i"
|
|
||||||
%include "interface/aiFileIO.i"
|
|
||||||
%include "interface/aiAssert.i"
|
|
||||||
%include "interface/aiVersion.i"
|
|
||||||
%include "interface/aiAnim.i"
|
|
||||||
%include "interface/aiMaterial.i"
|
|
||||||
%include "interface/aiMesh.i"
|
|
||||||
%include "interface/aiPostProcess.i"
|
|
||||||
%include "interface/aiConfig.i"
|
|
||||||
%include "interface/assimp.i"
|
|
||||||
%include "interface/aiQuaternion.i"
|
|
||||||
%include "interface/aiScene.i"
|
|
||||||
%include "interface/Logger.i"
|
|
||||||
%include "interface/DefaultLogger.i"
|
|
||||||
%include "interface/NullLogger.i"
|
|
||||||
%include "interface/LogStream.i"
|
|
||||||
%include "interface/IOStream.i"
|
|
||||||
%include "interface/IOSystem.i"
|
|
||||||
|
|
||||||
|
|
||||||
// We have to "instantiate" the templates used by the ASSSIMP_*_ARRAY macros
|
|
||||||
// here at the end to avoid running into forward reference issues (SWIG would
|
|
||||||
// spit out the helper functions before the header includes for the element
|
|
||||||
// types otherwise).
|
|
||||||
|
|
||||||
%template(UintVector) std::vector<unsigned int>;
|
|
||||||
%template(aiAnimationVector) std::vector<aiAnimation *>;
|
|
||||||
%template(aiAnimMeshVector) std::vector<aiAnimMesh *>;
|
|
||||||
%template(aiBonesVector) std::vector<aiBone *>;
|
|
||||||
%template(aiCameraVector) std::vector<aiCamera *>;
|
|
||||||
%template(aiColor4DVector) std::vector<aiColor4D *>;
|
|
||||||
%template(aiColor4DVectorVector) std::vector<std::vector<aiColor4D *> >;
|
|
||||||
%template(aiFaceVector) std::vector<aiFace *>;
|
|
||||||
%template(aiLightVector) std::vector<aiLight *>;
|
|
||||||
%template(aiMaterialVector) std::vector<aiMaterial *>;
|
|
||||||
%template(aiMaterialPropertyVector) std::vector<aiMaterialProperty *>;
|
|
||||||
%template(aiMeshAnimVector) std::vector<aiMeshAnim *>;
|
|
||||||
%template(aiMeshVector) std::vector<aiMesh *>;
|
|
||||||
%template(aiNodeVector) std::vector<aiNode *>;
|
|
||||||
%template(aiNodeAnimVector) std::vector<aiNodeAnim *>;
|
|
||||||
%template(aiTextureVector) std::vector<aiTexture *>;
|
|
||||||
%template(aiVector3DVector) std::vector<aiVector3D *>;
|
|
||||||
%template(aiVector3DVectorVector) std::vector<std::vector<aiVector3D *> >;
|
|
||||||
%template(aiVertexWeightVector) std::vector<aiVertexWeight *>;
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
gcc -shared -fPIC -g3 -I../../../include/ -lassimp -olibassimp_wrap.so assimp_wrap.cxx
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
rm -rf assimp/
|
|
||||||
mkdir assimp
|
|
||||||
swig -c++ -d -outcurrentdir -I../../../include -splitproxy -package assimp $@ ../assimp.i
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "DefaultLogger.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "DefaultLogger.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "IOStream.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "IOStream.h"
|
|
|
@ -1,11 +0,0 @@
|
||||||
%{
|
|
||||||
#include "IOSystem.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
// The const char* overload is used instead.
|
|
||||||
%ignore Assimp::IOSystem::Exists(const std::string&) const;
|
|
||||||
%ignore Assimp::IOSystem::Open(const std::string& pFile);
|
|
||||||
%ignore Assimp::IOSystem::Open(const std::string& pFile, const std::string& pMode);
|
|
||||||
%ignore Assimp::IOSystem::ComparePaths(const std::string& one, const std::string& second) const;
|
|
||||||
|
|
||||||
%include "IOSystem.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "LogStream.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "LogStream.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "Logger.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "Logger.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "NullLogger.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "NullLogger.h"
|
|
|
@ -1,8 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiAnim.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
ASSIMP_ARRAY(aiAnimation, aiNodeAnim*, mChannels, $self->mNumChannels);
|
|
||||||
ASSIMP_ARRAY(aiAnimation, aiMeshAnim*, mMeshChannels, $self->mNumMeshChannels);
|
|
||||||
|
|
||||||
%include "aiAnim.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiAssert.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiAssert.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiCamera.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiCamera.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiColor4D.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiColor4D.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiConfig.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiConfig.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiDefines.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiDefines.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiFileIO.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiFileIO.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiLight.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiLight.h"
|
|
|
@ -1,33 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiMaterial.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
ASSIMP_ARRAY(aiMaterial, aiMaterialProperty*, mProperties, $self->mNumProperties)
|
|
||||||
|
|
||||||
%include <typemaps.i>
|
|
||||||
%apply enum SWIGTYPE *OUTPUT { aiTextureMapping* mapping };
|
|
||||||
%apply unsigned int *OUTPUT { unsigned int* uvindex };
|
|
||||||
%apply float *OUTPUT { float* blend };
|
|
||||||
%apply enum SWIGTYPE *OUTPUT { aiTextureOp* op };
|
|
||||||
%apply unsigned int *OUTPUT { unsigned int* flags };
|
|
||||||
|
|
||||||
%include "aiMaterial.h"
|
|
||||||
|
|
||||||
%clear unsigned int* flags;
|
|
||||||
%clear aiTextureOp* op;
|
|
||||||
%clear float *blend;
|
|
||||||
%clear unsigned int* uvindex;
|
|
||||||
%clear aiTextureMapping* mapping;
|
|
||||||
|
|
||||||
|
|
||||||
%apply int &OUTPUT { int &pOut };
|
|
||||||
%apply float &OUTPUT { float &pOut };
|
|
||||||
|
|
||||||
%template(GetInteger) aiMaterial::Get<int>;
|
|
||||||
%template(GetFloat) aiMaterial::Get<float>;
|
|
||||||
%template(GetColor4D) aiMaterial::Get<aiColor4D>;
|
|
||||||
%template(GetColor3D) aiMaterial::Get<aiColor3D>;
|
|
||||||
%template(GetString) aiMaterial::Get<aiString>;
|
|
||||||
|
|
||||||
%clear int &pOut;
|
|
||||||
%clear float &pOut;
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiMatrix3x3.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiMatrix3x3.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiMatrix4x4.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiMatrix4x4.h"
|
|
|
@ -1,29 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiMesh.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
|
|
||||||
ASSIMP_ARRAY(aiFace, unsigned int, mIndices, $self->mNumIndices);
|
|
||||||
|
|
||||||
ASSIMP_POINTER_ARRAY(aiBone, aiVertexWeight, mWeights, $self->mNumWeights);
|
|
||||||
|
|
||||||
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mVertices, $self->mNumVertices);
|
|
||||||
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mNormals, $self->mNumVertices);
|
|
||||||
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mTangents, $self->mNumVertices);
|
|
||||||
ASSIMP_POINTER_ARRAY(aiAnimMesh, aiVector3D, mBitangents, $self->mNumVertices);
|
|
||||||
ASSIMP_POINTER_ARRAY_ARRAY(aiAnimMesh, aiVector3D, mTextureCoords, AI_MAX_NUMBER_OF_TEXTURECOORDS, $self->mNumVertices);
|
|
||||||
ASSIMP_POINTER_ARRAY_ARRAY(aiAnimMesh, aiColor4D, mColors, AI_MAX_NUMBER_OF_COLOR_SETS, $self->mNumVertices);
|
|
||||||
|
|
||||||
ASSIMP_ARRAY(aiMesh, aiAnimMesh*, mAnimMeshes, $self->mNumAnimMeshes);
|
|
||||||
ASSIMP_ARRAY(aiMesh, aiBone*, mBones, $self->mNumBones);
|
|
||||||
ASSIMP_ARRAY(aiMesh, unsigned int, mNumUVComponents, AI_MAX_NUMBER_OF_TEXTURECOORDS);
|
|
||||||
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mVertices, $self->mNumVertices);
|
|
||||||
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mNormals, $self->mNumVertices);
|
|
||||||
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mTangents, $self->mNumVertices);
|
|
||||||
ASSIMP_POINTER_ARRAY(aiMesh, aiVector3D, mBitangents, $self->mNumVertices);
|
|
||||||
ASSIMP_POINTER_ARRAY(aiMesh, aiFace, mFaces, $self->mNumFaces);
|
|
||||||
ASSIMP_POINTER_ARRAY_ARRAY(aiMesh, aiVector3D, mTextureCoords, AI_MAX_NUMBER_OF_TEXTURECOORDS, $self->mNumVertices);
|
|
||||||
ASSIMP_POINTER_ARRAY_ARRAY(aiMesh, aiColor4D, mColors, AI_MAX_NUMBER_OF_COLOR_SETS, $self->mNumVertices);
|
|
||||||
|
|
||||||
|
|
||||||
%include "aiMesh.h"
|
|
|
@ -1,7 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiPostProcess.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%feature("d:stripprefix", "aiProcess_") aiPostProcessSteps;
|
|
||||||
|
|
||||||
%include "aiPostProcess.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiQuaternion.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiQuaternion.h"
|
|
|
@ -1,17 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiScene.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
|
|
||||||
ASSIMP_ARRAY(aiScene, aiAnimation*, mAnimations, $self->mNumAnimations);
|
|
||||||
ASSIMP_ARRAY(aiScene, aiCamera*, mCameras, $self->mNumCameras);
|
|
||||||
ASSIMP_ARRAY(aiScene, aiLight*, mLights, $self->mNumLights);
|
|
||||||
ASSIMP_ARRAY(aiScene, aiMaterial*, mMaterials, $self->mNumMaterials);
|
|
||||||
ASSIMP_ARRAY(aiScene, aiMesh*, mMeshes, $self->mNumMeshes);
|
|
||||||
ASSIMP_ARRAY(aiScene, aiTexture*, mTextures, $self->mNumTextures);
|
|
||||||
|
|
||||||
ASSIMP_ARRAY(aiNode, aiNode*, mChildren, $self->mNumChildren);
|
|
||||||
ASSIMP_ARRAY(aiNode, unsigned int, mMeshes, $self->mNumMeshes);
|
|
||||||
|
|
||||||
|
|
||||||
%include "aiScene.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiTexture.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiTexture.h"
|
|
|
@ -1,8 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiTypes.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
// The const char* overload is used instead.
|
|
||||||
%ignore aiString::Set(const std::string& pString);
|
|
||||||
|
|
||||||
%include "aiTypes.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiVector2D.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiVector2D.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiVector3D.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiVector3D.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
%{
|
|
||||||
#include "aiVersion.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "aiVersion.h"
|
|
|
@ -1,45 +0,0 @@
|
||||||
%{
|
|
||||||
#include "assimp.hpp"
|
|
||||||
%}
|
|
||||||
|
|
||||||
|
|
||||||
namespace Assimp {
|
|
||||||
|
|
||||||
// See docs in assimp.hpp.
|
|
||||||
%ignore Importer::ReadFile(const std::string& pFile, unsigned int pFlags);
|
|
||||||
%ignore Importer::GetExtensionList(std::string& szOut);
|
|
||||||
%ignore Importer::IsExtensionSupported(const std::string& szExtension);
|
|
||||||
|
|
||||||
// These are only necessary for extending Assimp with custom importers or post
|
|
||||||
// processing steps, which would require wrapping the internal BaseImporter and
|
|
||||||
// BaseProcess classes.
|
|
||||||
%ignore Importer::RegisterLoader(BaseImporter* pImp);
|
|
||||||
%ignore Importer::UnregisterLoader(BaseImporter* pImp);
|
|
||||||
%ignore Importer::RegisterPPStep(BaseProcess* pImp);
|
|
||||||
%ignore Importer::UnregisterPPStep(BaseProcess* pImp);
|
|
||||||
%ignore Importer::FindLoader(const char* szExtension);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Each aiScene has to keep a reference to the Importer to prevent it from
|
|
||||||
// being garbage collected, whose destructor would release the underlying
|
|
||||||
// C++ memory the scene is stored in.
|
|
||||||
%typemap(dcode) aiScene "package Object m_importer;"
|
|
||||||
%typemap(dout)
|
|
||||||
aiScene* GetScene,
|
|
||||||
aiScene* ReadFile,
|
|
||||||
aiScene* ApplyPostProcessing,
|
|
||||||
aiScene* ReadFileFromMemory {
|
|
||||||
void* cPtr = $wcall;
|
|
||||||
$dclassname ret = (cPtr is null) ? null : new $dclassname(cPtr, $owner);$excode
|
|
||||||
ret.m_importer = this;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
%include <typemaps.i>
|
|
||||||
%apply bool *OUTPUT { bool *bWasExisting };
|
|
||||||
|
|
||||||
%include "assimp.hpp"
|
|
||||||
|
|
||||||
%clear bool *bWasExisting;
|
|
Loading…
Reference in New Issue