Merge branch 'master' into coverity_scan

Conflicts:
	test/regression/db.zip
pull/1007/head
Kim Kulling 2016-07-12 10:17:16 +02:00
commit 61c3674fa5
66 changed files with 591 additions and 381 deletions

1
.gitignore vendored
View File

@ -72,3 +72,4 @@ lib64/assimp-vc120-mtd.pdb
lib64/assimp-vc120-mtd.ilk
lib64/assimp-vc120-mtd.exp
lib64/assimp-vc120-mt.exp
xcuserdata

View File

@ -1,6 +1,6 @@
# Open Asset Import Library (assimp)
# ----------------------------------------------------------------------
#
#
# Copyright (c) 2006-2016, assimp team
# All rights reserved.
#
@ -46,8 +46,8 @@ ENDIF(NOT BUILD_SHARED_LIBS)
# Define here the needed parameters
SET (ASSIMP_VERSION_MAJOR 3)
SET (ASSIMP_VERSION_MINOR 2)
SET (ASSIMP_VERSION_PATCH 0) # subversion revision?
SET (ASSIMP_VERSION_MINOR 3)
SET (ASSIMP_VERSION_PATCH 1) # subversion revision?
SET (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
SET (ASSIMP_SOVERSION 3)
SET (PROJECT_VERSION "${ASSIMP_VERSION}")
@ -176,7 +176,15 @@ ENDIF( CMAKE_COMPILER_IS_GNUCXX )
# Search for external dependencies, and build them from source if not found
# Search for zlib
find_package(ZLIB)
OPTION(ASSIMP_BUILD_ZLIB
"Build your own zlib"
OFF
)
IF ( NOT ASSIMP_BUILD_ZLIB )
find_package(ZLIB)
ENDIF( NOT ASSIMP_BUILD_ZLIB )
IF( NOT ZLIB_FOUND )
message(STATUS "compiling zlib from souces")
include(CheckIncludeFile)
@ -229,31 +237,33 @@ SET ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER OFF CACHE BOOL
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
IF ( MSVC )
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/_melange/includes")
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/includes")
# pick the correct prebuilt library
IF(MSVC11)
SET(C4D_LIB_POSTFIX "_2012md")
IF(MSVC14)
SET(C4D_LIB_POSTFIX "_2015")
ELSEIF(MSVC12)
SET(C4D_LIB_POSTFIX "_2013")
ELSEIF(MSVC11)
SET(C4D_LIB_POSTFIX "_2012")
ELSEIF(MSVC10)
SET(C4D_LIB_POSTFIX "_2010md")
ELSEIF(MSVC90)
SET(C4D_LIB_POSTFIX "_2008md")
SET(C4D_LIB_POSTFIX "_2010")
ELSE()
MESSAGE( FATAL_ERROR
"C4D is currently only supported with MSVC 9, 10, 11"
"C4D is currently only supported with MSVC 10, 11, 12, 14"
)
ENDIF()
IF(CMAKE_CL_64)
SET(C4D_LIB_ARCH_POSTFIX "_x64")
ELSE()
SET(C4D_LIB_ARCH_POSTFIX "")
ENDIF()
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/libraries/win")
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/_melange/lib/WIN")
SET(C4D_DEBUG_LIBRARY "${C4D_LIB_BASE_PATH}/debug/_melange_lib${C4D_LIB_ARCH_POSTFIX}${C4D_LIB_POSTFIX}.lib")
SET(C4D_RELEASE_LIBRARY "${C4D_LIB_BASE_PATH}/release/_melange_lib${C4D_LIB_ARCH_POSTFIX}${C4D_LIB_POSTFIX}.lib")
SET(C4D_DEBUG_LIBRARIES
"${C4D_LIB_BASE_PATH}/melangelib${C4D_LIB_POSTFIX}/melangelib_debug.lib"
"${C4D_LIB_BASE_PATH}/jpeglib${C4D_LIB_POSTFIX}/jpeglib_debug.lib"
)
SET(C4D_RELEASE_LIBRARIES
"${C4D_LIB_BASE_PATH}/melangelib${C4D_LIB_POSTFIX}/melangelib_release.lib"
"${C4D_LIB_BASE_PATH}/jpeglib${C4D_LIB_POSTFIX}/jpeglib_release.lib"
)
# winsock and winmm are necessary dependencies of melange (this is undocumented, but true.)
SET(C4D_EXTRA_LIBRARIES WSock32.lib Winmm.lib)
@ -279,7 +289,7 @@ IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
ADD_SUBDIRECTORY( tools/assimp_view/ )
ENDIF ( ASSIMP_BUILD_ASSIMP_VIEW )
ENDIF ( WIN32 )
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )

View File

@ -50,6 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderBMesh.h"
#include "BlenderTessellator.h"
#include <stddef.h>
static const unsigned int BLEND_TESS_MAGIC = 0x83ed9ac3;
#if ASSIMP_BLEND_WITH_GLU_TESSELLATE
@ -372,14 +374,9 @@ void BlenderTessellatorP2T::ReferencePoints( std::vector< Blender::PointP2T >& p
}
// ------------------------------------------------------------------------------------------------
// Yes this is filthy... but we have no choice
#define OffsetOf( Class, Member ) ( static_cast< unsigned int >( \
reinterpret_cast<uint8_t*>(&( reinterpret_cast< Class* >( NULL )->*( &Class::Member ) )) - \
static_cast<uint8_t*>(NULL) ) )
inline PointP2T& BlenderTessellatorP2T::GetActualPointStructure( p2t::Point& point ) const
{
unsigned int pointOffset = OffsetOf( PointP2T, point2D );
unsigned int pointOffset = offsetof( PointP2T, point2D );
PointP2T& pointStruct = *reinterpret_cast< PointP2T* >( reinterpret_cast< char* >( &point ) - pointOffset );
if ( pointStruct.magic != static_cast<int>( BLEND_TESS_MAGIC ) )
{

View File

@ -52,6 +52,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "C4DImporter.h"
#include "TinyFormatter.h"
#include <memory>
#include <assimp/IOSystem.hpp>
#include <assimp/scene.h>
#include <assimp/ai_assert.h>
#if defined(_M_X64) || defined(__amd64__)
# define __C4D_64BIT
@ -61,10 +65,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "c4d_file.h"
#include "default_alien_overloads.h"
using namespace _melange_;
using namespace melange;
// overload this function and fill in your own unique data
void GetWriterInfo(LONG &id, String &appname)
void GetWriterInfo(int &id, String &appname)
{
id = 2424226;
appname = "Open Asset Import Library";
@ -197,7 +201,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
// ------------------------------------------------------------------------------------------------
bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader)
bool C4DImporter::ReadShader(aiMaterial* out, melange::BaseShader* shader)
{
// based on Melange sample code (C4DImportExport.cpp)
while(shader) {
@ -263,7 +267,7 @@ bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader)
// ------------------------------------------------------------------------------------------------
void C4DImporter::ReadMaterials(_melange_::BaseMaterial* mat)
void C4DImporter::ReadMaterials(melange::BaseMaterial* mat)
{
// based on Melange sample code
while (mat)
@ -288,7 +292,7 @@ void C4DImporter::ReadMaterials(_melange_::BaseMaterial* mat)
mat->GetParameter(MATERIAL_COLOR_COLOR, data);
Vector color = data.GetVector();
mat->GetParameter(MATERIAL_COLOR_BRIGHTNESS, data);
const Real brightness = data.GetReal();
const Float brightness = data.GetFloat();
color *= brightness;
@ -507,11 +511,13 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
// copy normals
if (normals_src) {
if(i >= normals_src->GetNormalCount()) {
if(i >= normals_src->GetDataCount()) {
LogError("unexpected number of normals, ignoring");
}
else {
const NormalStruct& nor = normals_src->GetNormals(i);
ConstNormalHandle normal_handle = normals_src->GetDataAddressR();
NormalStruct nor;
NormalTag::Get(normal_handle, i, nor);
normals->x = nor.a.x;
normals->y = nor.a.y;
normals->z = nor.a.z;

View File

@ -54,7 +54,7 @@ struct aiMaterial;
struct aiImporterDesc;
namespace _melange_ {
namespace melange {
class BaseObject; // c4d_file.h
class PolygonObject;
class BaseMaterial;
@ -103,17 +103,17 @@ protected:
private:
void ReadMaterials(_melange_::BaseMaterial* mat);
void RecurseHierarchy(_melange_::BaseObject* object, aiNode* parent);
aiMesh* ReadMesh(_melange_::BaseObject* object);
unsigned int ResolveMaterial(_melange_::PolygonObject* obj);
void ReadMaterials(melange::BaseMaterial* mat);
void RecurseHierarchy(melange::BaseObject* object, aiNode* parent);
aiMesh* ReadMesh(melange::BaseObject* object);
unsigned int ResolveMaterial(melange::PolygonObject* obj);
bool ReadShader(aiMaterial* out, _melange_::BaseShader* shader);
bool ReadShader(aiMaterial* out, melange::BaseShader* shader);
std::vector<aiMesh*> meshes;
std::vector<aiMaterial*> materials;
typedef std::map<_melange_::BaseMaterial*, unsigned int> MaterialMap;
typedef std::map<melange::BaseMaterial*, unsigned int> MaterialMap;
MaterialMap material_mapping;
}; // !class C4DImporter

View File

@ -775,8 +775,8 @@ if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
endif(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
TARGET_LINK_LIBRARIES(assimp optimized ${C4D_RELEASE_LIBRARY})
TARGET_LINK_LIBRARIES(assimp debug ${C4D_DEBUG_LIBRARY})
TARGET_LINK_LIBRARIES(assimp optimized ${C4D_RELEASE_LIBRARIES})
TARGET_LINK_LIBRARIES(assimp debug ${C4D_DEBUG_LIBRARIES})
TARGET_LINK_LIBRARIES(assimp ${C4D_EXTRA_LIBRARIES})
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)

View File

@ -94,6 +94,7 @@ ColladaExporter::ColladaExporter( const aiScene* pScene, IOSystem* pIOSystem, co
{
// make sure that all formatting happens using the standard, C locale and not the user's current locale
mOutput.imbue( std::locale("C") );
mOutput.precision(16);
mScene = pScene;
mSceneOwned = false;
@ -1061,9 +1062,9 @@ void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
}
const std::string node_name_escaped = XMLEscape(pNode->mName.data);
mOutput << startstr
<< "<node id=\"" << node_name_escaped
<< "\" name=\"" << node_name_escaped
mOutput << startstr
<< "<node id=\"" << node_name_escaped
<< "\" name=\"" << node_name_escaped
<< "\" type=\"" << node_type
<< "\">" << endstr;
PushTag();

View File

@ -58,8 +58,8 @@ class DeadlyImportError
{
public:
/** Constructor with arguments */
explicit DeadlyImportError( const std::string& pErrorText)
: runtime_error(pErrorText)
explicit DeadlyImportError( const std::string& errorText)
: runtime_error(errorText)
{
}

View File

@ -94,7 +94,9 @@ ObjExporter :: ObjExporter(const char* _filename, const aiScene* pScene)
// make sure that all formatting happens using the standard, C locale and not the user's current locale
const std::locale& l = std::locale("C");
mOutput.imbue(l);
mOutput.precision(16);
mOutputMat.imbue(l);
mOutputMat.precision(16);
WriteGeometryFile();
WriteMaterialFile();

View File

@ -99,6 +99,7 @@ PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool bina
// make sure that all formatting happens using the standard, C locale and not the user's current locale
const std::locale& l = std::locale("C");
mOutput.imbue(l);
mOutput.precision(16);
unsigned int faces = 0u, vertices = 0u, components = 0u;
for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {

View File

@ -94,6 +94,7 @@ STLExporter :: STLExporter(const char* _filename, const aiScene* pScene, bool bi
// make sure that all formatting happens using the standard, C locale and not the user's current locale
const std::locale& l = std::locale("C");
mOutput.imbue(l);
mOutput.precision(16);
if (binary) {
char buf[80] = {0} ;
buf[0] = 'A'; buf[1] = 's'; buf[2] = 's'; buf[3] = 'i'; buf[4] = 'm'; buf[5] = 'p';

View File

@ -146,6 +146,7 @@ StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std
// make sure that all formatting happens using the standard, C locale and not the user's current locale
mOutput.imbue( std::locale("C") );
mOutput.precision(16);
// start writing
WriteFile();
@ -158,7 +159,9 @@ void StepExporter::WriteFile()
// see http://shodhganga.inflibnet.ac.in:8080/jspui/bitstream/10603/14116/11/11_chapter%203.pdf
// note, that all realnumber values must be comma separated in x files
mOutput.setf(std::ios::fixed);
mOutput.precision(16); // precission for double
// precission for double
// see http://stackoverflow.com/questions/554063/how-do-i-print-a-double-value-with-full-precision-using-cout
mOutput.precision(16);
// standard color
aiColor4D fColor;
@ -365,4 +368,3 @@ void StepExporter::WriteFile()
#endif
#endif

View File

@ -6,7 +6,7 @@
#include "ScenePrivate.h"
static const unsigned int MajorVersion = 3;
static const unsigned int MinorVersion = 2;
static const unsigned int MinorVersion = 3;
// --------------------------------------------------------------------------------
// Legal information string - dont't remove this.
@ -15,7 +15,7 @@ static const char* LEGAL_INFORMATION =
"Open Asset Import Library (Assimp).\n"
"A free C/C++ library to import various 3D file formats into applications\n\n"
"(c) 2008-2010, assimp team\n"
"(c) 2008-2016, assimp team\n"
"License under the terms and conditions of the 3-clause BSD license\n"
"http://assimp.sourceforge.net\n"
;

View File

@ -104,6 +104,7 @@ XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const s
{
// make sure that all formatting happens using the standard, C locale and not the user's current locale
mOutput.imbue( std::locale("C") );
mOutput.precision(16);
// start writing
WriteFile();
@ -529,4 +530,3 @@ void XFileExporter::writePath(aiString path)
#endif
#endif

View File

@ -3,13 +3,13 @@
* BSD License:
****************************************************************************
*
* Copyright (c) 2005-2011 Paul Hsieh
* Copyright (c) 2005-2016 Paul Hsieh
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@ -17,7 +17,7 @@
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@ -31,7 +31,7 @@
*
****************************************************************************
*
* Version 0.1.12
* Version 0.1.15.4
*
* The ANSI C standard committee, for the C99 standard, specified the
* inclusion of a new standard include file called stdint.h. This is
@ -42,19 +42,17 @@
* integer libraries and so on. But for most developers its likely
* useful just for programming sanity.
*
* The problem is that most compiler vendors have decided not to
* implement the C99 standard, and the next C++ language standard
* (which has a lot more mindshare these days) will be a long time in
* coming and its unknown whether or not it will include stdint.h or
* how much adoption it will have. Either way, it will be a long time
* before all compilers come with a stdint.h and it also does nothing
* for the extremely large number of compilers available today which
* do not include this file, or anything comparable to it.
* The problem is that some compiler vendors chose to ignore the C99
* standard and some older compilers have no opportunity to be updated.
* Because of this situation, simply including stdint.h in your code
* makes it unportable.
*
* So that's what this file is all about. Its an attempt to build a
* single universal include file that works on as many platforms as
* possible to deliver what stdint.h is supposed to. A few things
* that should be noted about this file:
* possible to deliver what stdint.h is supposed to. Even compilers
* that already come with stdint.h can use this file instead without
* any loss of functionality. A few things that should be noted about
* this file:
*
* 1) It is not guaranteed to be portable and/or present an identical
* interface on all platforms. The extreme variability of the
@ -154,7 +152,12 @@
* PRINTF_INT64_DEC_WIDTH
* PRINTF_INT32_DEC_WIDTH
* PRINTF_INT16_DEC_WIDTH
* PRINTF_INT8_DEC_WIDTH
* PRINTF_UINT8_DEC_WIDTH
* PRINTF_UINTMAX_DEC_WIDTH
* PRINTF_UINT64_DEC_WIDTH
* PRINTF_UINT32_DEC_WIDTH
* PRINTF_UINT16_DEC_WIDTH
* PRINTF_UINT8_DEC_WIDTH
*
* Which specifies the maximum number of characters required to
* print the number of that type in either hexadecimal or decimal.
@ -172,8 +175,6 @@
*
* Acknowledgements
*
* Edited by Philip G. Lee <rocketman768@gmail.com> 2011 to avoid overlap with sys/types.h
*
* The following people have made significant contributions to the
* development and testing of this file:
*
@ -181,6 +182,9 @@
* John Steele Scott
* Dave Thorup
* John Dill
* Florian Wobbe
* Christopher Sean Morrison
* Mikkel Fahnoe Jorgensen
*
*/
@ -193,14 +197,27 @@
* do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.
*/
#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
#include <stdint.h>
#define _PSTDINT_H_INCLUDED
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__))
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "l"
# endif
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
# else
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# ifndef PRINTF_INT32_MODIFIER
# if (UINT_MAX == UINT32_MAX)
# define PRINTF_INT32_MODIFIER ""
# else
# define PRINTF_INT32_MODIFIER "l"
# endif
# endif
# endif
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
@ -211,32 +228,62 @@
# ifndef PRINTF_INT64_HEX_WIDTH
# define PRINTF_INT64_HEX_WIDTH "16"
# endif
# ifndef PRINTF_UINT64_HEX_WIDTH
# define PRINTF_UINT64_HEX_WIDTH "16"
# endif
# ifndef PRINTF_INT32_HEX_WIDTH
# define PRINTF_INT32_HEX_WIDTH "8"
# endif
# ifndef PRINTF_UINT32_HEX_WIDTH
# define PRINTF_UINT32_HEX_WIDTH "8"
# endif
# ifndef PRINTF_INT16_HEX_WIDTH
# define PRINTF_INT16_HEX_WIDTH "4"
# endif
# ifndef PRINTF_UINT16_HEX_WIDTH
# define PRINTF_UINT16_HEX_WIDTH "4"
# endif
# ifndef PRINTF_INT8_HEX_WIDTH
# define PRINTF_INT8_HEX_WIDTH "2"
# endif
# ifndef PRINTF_UINT8_HEX_WIDTH
# define PRINTF_UINT8_HEX_WIDTH "2"
# endif
# ifndef PRINTF_INT64_DEC_WIDTH
# define PRINTF_INT64_DEC_WIDTH "20"
# define PRINTF_INT64_DEC_WIDTH "19"
# endif
# ifndef PRINTF_UINT64_DEC_WIDTH
# define PRINTF_UINT64_DEC_WIDTH "20"
# endif
# ifndef PRINTF_INT32_DEC_WIDTH
# define PRINTF_INT32_DEC_WIDTH "10"
# endif
# ifndef PRINTF_UINT32_DEC_WIDTH
# define PRINTF_UINT32_DEC_WIDTH "10"
# endif
# ifndef PRINTF_INT16_DEC_WIDTH
# define PRINTF_INT16_DEC_WIDTH "5"
# endif
# ifndef PRINTF_UINT16_DEC_WIDTH
# define PRINTF_UINT16_DEC_WIDTH "5"
# endif
# ifndef PRINTF_INT8_DEC_WIDTH
# define PRINTF_INT8_DEC_WIDTH "3"
# endif
# ifndef PRINTF_UINT8_DEC_WIDTH
# define PRINTF_UINT8_DEC_WIDTH "3"
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH
# endif
# ifndef PRINTF_UINTMAX_HEX_WIDTH
# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH
# endif
# ifndef PRINTF_UINTMAX_DEC_WIDTH
# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH
# endif
/*
@ -290,6 +337,20 @@
# endif
#endif
/*
* I have no idea what is the truly correct thing to do on older Solaris.
* From some online discussions, this seems to be what is being
* recommended. For people who actually are developing on older Solaris,
* what I would like to know is, does this define all of the relevant
* macros of a complete stdint.h? Remember, in pstdint.h 64 bit is
* considered optional.
*/
#if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x420) && !defined(_PSTDINT_H_INCLUDED)
#include <sys/inttypes.h>
#define _PSTDINT_H_INCLUDED
#endif
#ifndef _PSTDINT_H_INCLUDED
#define _PSTDINT_H_INCLUDED
@ -303,115 +364,10 @@
* definitions.
*/
// Avoid overlap with sys/types.h
#ifndef __int8_t_defined
#define __int8_t_defined
#ifndef INT8_MAX
# define INT8_MAX 0x7f
#endif
#ifndef INT8_MIN
# define INT8_MIN INT8_C(0x80)
#endif
#ifndef int8_t
# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
typedef signed char int8_t;
# define INT8_C(v) ((int8_t) v)
# else
# error "Platform not supported"
# endif
#endif
#ifndef INT16_MAX
# define INT16_MAX 0x7fff
#endif
#ifndef INT16_MIN
# define INT16_MIN INT16_C(0x8000)
#endif
#ifndef int16_t
#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
typedef signed int int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER ""
# endif
#elif (SHRT_MAX == INT16_MAX)
typedef signed short int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef INT32_MAX
# define INT32_MAX (0x7fffffffL)
#endif
#ifndef INT32_MIN
# define INT32_MIN INT32_C(0x80000000)
#endif
#ifndef int32_t
#if ((LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)) && ! defined(__FreeBSD__)
typedef signed long int32_t;
# define INT32_C(v) v ## L
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
#elif (INT_MAX == INT32_MAX)
typedef signed int int32_t;
# define INT32_C(v) v
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#elif (SHRT_MAX == INT32_MAX)
typedef signed short int32_t;
# define INT32_C(v) ((short) (v))
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#else
#error "Platform not supported"
#endif
#endif
// 64-bit shit seems more tricky. Philip Lee <rocketman768@gmail.com>
/*
* The macro stdint_int64_defined is temporarily used to record
* whether or not 64 integer support is available. It must be
* defined for any 64 integer extensions for new platforms that are
* added.
*/
#undef stdint_int64_defined
#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
# endif
#endif
#if !defined (stdint_int64_defined)
# if defined(__GNUC__)
# define stdint_int64_defined
# ifndef __FreeBSD__
__extension__ typedef long long int64_t;
# endif
# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
# define stdint_int64_defined
typedef __int64 int64_t;
# endif
#endif
#endif /*ifndef __int8_t_defined*/
#ifndef UINT8_MAX
# define UINT8_MAX 0xff
#endif
#ifndef uint8_t
#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks)
# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
typedef unsigned char uint8_t;
# define UINT8_C(v) ((uint8_t) v)
@ -420,10 +376,25 @@ typedef __int64 int64_t;
# endif
#endif
#ifndef INT8_MAX
# define INT8_MAX 0x7f
#endif
#ifndef INT8_MIN
# define INT8_MIN INT8_C(0x80)
#endif
#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks)
# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
typedef signed char int8_t;
# define INT8_C(v) ((int8_t) v)
# else
# error "Platform not supported"
# endif
#endif
#ifndef UINT16_MAX
# define UINT16_MAX 0xffff
#endif
#ifndef uint16_t
#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks)
#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
typedef unsigned int uint16_t;
# ifndef PRINTF_INT16_MODIFIER
@ -441,11 +412,35 @@ typedef __int64 int64_t;
#endif
#endif
#ifndef INT16_MAX
# define INT16_MAX 0x7fff
#endif
#ifndef INT16_MIN
# define INT16_MIN INT16_C(0x8000)
#endif
#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks)
#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
typedef signed int int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER ""
# endif
#elif (SHRT_MAX == INT16_MAX)
typedef signed short int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef UINT32_MAX
# define UINT32_MAX (0xffffffffUL)
#endif
#ifndef uint32_t
#if ((ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)) && ! defined(__FreeBSD__)
#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks)
#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
typedef unsigned long uint32_t;
# define UINT32_C(v) v ## UL
# ifndef PRINTF_INT32_MODIFIER
@ -468,6 +463,36 @@ typedef __int64 int64_t;
#endif
#endif
#ifndef INT32_MAX
# define INT32_MAX (0x7fffffffL)
#endif
#ifndef INT32_MIN
# define INT32_MIN INT32_C(0x80000000)
#endif
#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks)
#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
typedef signed long int32_t;
# define INT32_C(v) v ## L
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
#elif (INT_MAX == INT32_MAX)
typedef signed int int32_t;
# define INT32_C(v) v
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#elif (SHRT_MAX == INT32_MAX)
typedef signed short int32_t;
# define INT32_C(v) ((short) (v))
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#else
#error "Platform not supported"
#endif
#endif
/*
* The macro stdint_int64_defined is temporarily used to record
* whether or not 64 integer support is available. It must be
@ -479,9 +504,8 @@ typedef __int64 int64_t;
#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
# define stdint_int64_defined
# ifndef __FreeBSD__
typedef unsigned long long uint64_t;
# endif
typedef long long int64_t;
typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
@ -491,11 +515,10 @@ typedef __int64 int64_t;
#endif
#if !defined (stdint_int64_defined)
# if defined(__GNUC__)
# if defined(__GNUC__) && !defined(vxWorks)
# define stdint_int64_defined
# ifndef __FreeBSD__
__extension__ typedef unsigned long long uint64_t;
# endif
__extension__ typedef long long int64_t;
__extension__ typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
@ -503,6 +526,7 @@ typedef __int64 int64_t;
# endif
# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
@ -511,6 +535,7 @@ typedef __int64 int64_t;
# endif
# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
# define stdint_int64_defined
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
# define UINT64_C(v) v ## UI64
# define INT64_C(v) v ## I64
@ -553,9 +578,8 @@ typedef __int64 int64_t;
#ifndef PRINTF_INT8_HEX_WIDTH
# define PRINTF_INT8_HEX_WIDTH "2"
#endif
#ifndef PRINTF_INT64_DEC_WIDTH
# define PRINTF_INT64_DEC_WIDTH "20"
# define PRINTF_INT64_DEC_WIDTH "19"
#endif
#ifndef PRINTF_INT32_DEC_WIDTH
# define PRINTF_INT32_DEC_WIDTH "10"
@ -566,6 +590,18 @@ typedef __int64 int64_t;
#ifndef PRINTF_INT8_DEC_WIDTH
# define PRINTF_INT8_DEC_WIDTH "3"
#endif
#ifndef PRINTF_UINT64_DEC_WIDTH
# define PRINTF_UINT64_DEC_WIDTH "20"
#endif
#ifndef PRINTF_UINT32_DEC_WIDTH
# define PRINTF_UINT32_DEC_WIDTH "10"
#endif
#ifndef PRINTF_UINT16_DEC_WIDTH
# define PRINTF_UINT16_DEC_WIDTH "5"
#endif
#ifndef PRINTF_UINT8_DEC_WIDTH
# define PRINTF_UINT8_DEC_WIDTH "3"
#endif
/*
* Ok, lets not worry about 128 bit integers for now. Moore's law says
@ -655,12 +691,10 @@ typedef __int64 int64_t;
* stdint.h.
*/
#ifndef __FreeBSD__
typedef int_least8_t int_fast8_t;
typedef uint_least8_t uint_fast8_t;
typedef int_least16_t int_fast16_t;
typedef uint_least16_t uint_fast16_t;
#endif
typedef int_least32_t int_fast32_t;
typedef uint_least32_t uint_fast32_t;
#define UINT_FAST8_MAX UINT_LEAST8_MAX
@ -687,7 +721,7 @@ typedef uint_least32_t uint_fast32_t;
* type limits.
*/
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks)
# include <wchar.h>
# ifndef WCHAR_MIN
# define WCHAR_MIN 0
@ -702,12 +736,12 @@ typedef uint_least32_t uint_fast32_t;
* (u)intptr_t types and limits.
*/
#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T)
# define STDINT_H_UINTPTR_T_DEFINED
#endif
#ifndef STDINT_H_UINTPTR_T_DEFINED
# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__)
# define stdint_intptr_bits 64
# elif defined (__WATCOMC__) || defined (__TURBOC__)
# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
@ -715,10 +749,12 @@ typedef uint_least32_t uint_fast32_t;
# else
# define stdint_intptr_bits 32
# endif
# elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__)
# define stdint_intptr_bits 32
# elif defined (__INTEL_COMPILER)
/* TODO -- what did Intel do about x86-64? */
# else
/* #error "This platform might not be supported yet" */
# endif
# ifdef stdint_intptr_bits
@ -748,15 +784,8 @@ typedef uint_least32_t uint_fast32_t;
# ifndef UINTPTR_C
# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
# endif
// Philip <rocketman768@gmail.com>, need to check if [u]intprt_t is already defined...
# ifndef __uintptr_t_defined
# define __uintptr_t_defined
typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
# endif /*uintptr_t*/
# ifndef __intptr_t_defined
# define __intptr_t_defined
typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
# endif /*__intptr_t_defined*/
typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
# else
/* TODO -- This following is likely wrong for some platforms, and does
nothing for the definition of uintptr_t. */
@ -777,71 +806,107 @@ typedef uint_least32_t uint_fast32_t;
#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
/*
* Please compile with the maximum warning settings to make sure macros are not
* defined more than once.
/*
* Please compile with the maximum warning settings to make sure macros are
* not defined more than once.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define glue3_aux(x,y,z) x ## y ## z
#define glue3(x,y,z) glue3_aux(x,y,z)
#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0);
#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0);
#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0);
#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0);
#define DECL(us,bits) glue3(DECL,us,) (bits)
#define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits)
#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf ("Something wrong with UINT%d_MAX\n", bits)
#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; }
int main () {
DECL(I,8)
DECL(U,8)
DECL(I,16)
DECL(U,16)
DECL(I,32)
DECL(U,32)
int err_n = 0;
int err_first = 0;
DECL(I,8)
DECL(U,8)
DECL(I,16)
DECL(U,16)
DECL(I,32)
DECL(U,32)
#ifdef INT64_MAX
DECL(I,64)
DECL(U,64)
DECL(I,64)
DECL(U,64)
#endif
intmax_t imax = INTMAX_C(0);
uintmax_t umax = UINTMAX_C(0);
char str0[256], str1[256];
intmax_t imax = INTMAX_C(0);
uintmax_t umax = UINTMAX_C(0);
char str0[256], str1[256];
sprintf (str0, "%d %x\n", 0, ~0);
sprintf (str1, "%d %x\n", i8, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1);
sprintf (str1, "%u %x\n", u8, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1);
sprintf (str1, "%d %x\n", i16, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1);
sprintf (str1, "%u %x\n", u16, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1);
sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1);
sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1);
#ifdef INT64_MAX
sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1);
#endif
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1);
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1);
TESTUMAX(8);
TESTUMAX(16);
TESTUMAX(32);
sprintf (str0, "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647));
if (0 != strcmp (str0, "2147483647")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0));
if (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_INT32_DEC_WIDTH : %s\n", PRINTF_INT32_DEC_WIDTH));
sprintf (str0, "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295));
if (0 != strcmp (str0, "4294967295")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0));
if (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\n", PRINTF_UINT32_DEC_WIDTH));
#ifdef INT64_MAX
TESTUMAX(64);
sprintf (str1, "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807));
if (0 != strcmp (str1, "9223372036854775807")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1));
if (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\n", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1)));
sprintf (str1, "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591));
if (0 != strcmp (str1, "18446744073709550591")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1));
if (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\n", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1)));
#endif
return EXIT_SUCCESS;
sprintf (str0, "%d %x\n", 0, ~0);
sprintf (str1, "%d %x\n", i8, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i8 : %s\n", str1));
sprintf (str1, "%u %x\n", u8, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u8 : %s\n", str1));
sprintf (str1, "%d %x\n", i16, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i16 : %s\n", str1));
sprintf (str1, "%u %x\n", u16, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u16 : %s\n", str1));
sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i32 : %s\n", str1));
sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u32 : %s\n", str1));
#ifdef INT64_MAX
sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i64 : %s\n", str1));
#endif
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with imax : %s\n", str1));
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with umax : %s\n", str1));
TESTUMAX(8);
TESTUMAX(16);
TESTUMAX(32);
#ifdef INT64_MAX
TESTUMAX(64);
#endif
#define STR(v) #v
#define Q(v) printf ("sizeof " STR(v) " = %u\n", (unsigned) sizeof (v));
if (err_n) {
printf ("pstdint.h is not correct. Please use sizes below to correct it:\n");
}
Q(int)
Q(unsigned)
Q(long int)
Q(short int)
Q(int8_t)
Q(int16_t)
Q(int32_t)
#ifdef INT64_MAX
Q(int64_t)
#endif
return EXIT_SUCCESS;
}
#endif

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file Exporter.hpp
* @brief Defines the CPP-API for the Assimp export interface
*/
#pragma once
#ifndef AI_EXPORT_HPP_INC
#define AI_EXPORT_HPP_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief File I/O wrappers for C++.
*/
#pragma once
#ifndef AI_IOSTREAM_H_INC
#define AI_IOSTREAM_H_INC

View File

@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* custom file handling logic to the Import library.
*/
#pragma once
#ifndef AI_IOSYSTEM_H_INC
#define AI_IOSYSTEM_H_INC

View File

@ -42,12 +42,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file Importer.hpp
* @brief Defines the C++-API to the Open Asset Import Library.
*/
#ifndef INCLUDED_AI_ASSIMP_HPP
#define INCLUDED_AI_ASSIMP_HPP
#pragma once
#ifndef AI_ASSIMP_HPP_INC
#define AI_ASSIMP_HPP_INC
#ifndef __cplusplus
# error This header requires C++ to be used. Use assimp.h for plain C.
#endif
#endif // __cplusplus
// Public ASSIMP data structures
#include "types.h"
@ -658,4 +659,5 @@ AI_FORCE_INLINE bool Importer::IsExtensionSupported(const std::string& szExtensi
}
} // !namespace Assimp
#endif // INCLUDED_AI_ASSIMP_HPP
#endif // AI_ASSIMP_HPP_INC

View File

@ -41,9 +41,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file ProgressHandler.hpp
* @brief Abstract base class 'ProgressHandler'.
*/
#ifndef INCLUDED_AI_PROGRESSHANDLER_H
#define INCLUDED_AI_PROGRESSHANDLER_H
#pragma once
#ifndef AI_PROGRESSHANDLER_H_INC
#define AI_PROGRESSHANDLER_H_INC
#include "types.h"
namespace Assimp {
// ------------------------------------------------------------------------------------
@ -119,4 +122,4 @@ public:
// ------------------------------------------------------------------------------------
} // Namespace Assimp
#endif
#endif // AI_PROGRESSHANDLER_H_INC

View File

@ -38,15 +38,15 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
#ifndef AI_DEBUG_H_INC
#define AI_DEBUG_H_INC
#pragma once
#ifndef AI_ASSERT_H_INC
#define AI_ASSERT_H_INC
#ifdef ASSIMP_BUILD_DEBUG
# include <assert.h>
# define ai_assert(expression) assert(expression)
#else
# define ai_assert(expression)
#endif
#endif //
#endif
#endif // AI_ASSERT_H_INC

View File

@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Defines the data structures in which the imported animations
* are returned.
*/
#pragma once
#ifndef AI_ANIM_H_INC
#define AI_ANIM_H_INC

View File

@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Defines the aiCamera data structure
*/
#pragma once
#ifndef AI_CAMERA_H_INC
#define AI_CAMERA_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file cexport.h
* @brief Defines the C-API for the Assimp export interface
*/
#pragma once
#ifndef AI_EXPORT_H_INC
#define AI_EXPORT_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file cfileio.h
* @brief Defines generic C routines to access memory-mapped files
*/
#pragma once
#ifndef AI_FILEIO_H_INC
#define AI_FILEIO_H_INC

View File

@ -42,8 +42,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file cimport.h
* @brief Defines the C-API to the Open Asset Import Library.
*/
#pragma once
#ifndef AI_ASSIMP_H_INC
#define AI_ASSIMP_H_INC
#include "types.h"
#include "importerdesc.h"

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file color4.h
* @brief RGBA color structure, including operators when compiling in C++
*/
#pragma once
#ifndef AI_COLOR4D_H_INC
#define AI_COLOR4D_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file color4.inl
* @brief Inline implementation of aiColor4t<TReal> operators
*/
#pragma once
#ifndef AI_COLOR4D_INL_INC
#define AI_COLOR4D_INL_INC

View File

@ -55,8 +55,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* #aiSetImportPropertyFloat,
* #aiSetImportPropertyString
*/
#ifndef INCLUDED_AI_CONFIG_H
#define INCLUDED_AI_CONFIG_H
#pragma once
#ifndef AI_CONFIG_H_INC
#define AI_CONFIG_H_INC
// ###########################################################################

View File

@ -44,8 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* blocks to find out how to customize _your_ Assimp build.
*/
#ifndef INCLUDED_AI_DEFINES_H
#define INCLUDED_AI_DEFINES_H
#pragma once
#ifndef AI_DEFINES_H_INC
#define AI_DEFINES_H_INC
//////////////////////////////////////////////////////////////////////////
/* Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific
@ -269,4 +270,4 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))
#endif // !! INCLUDED_AI_DEFINES_H
#endif // !! AI_DEFINES_H_INC

View File

@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file importerdesc.h
* @brief #aiImporterFlags, aiImporterDesc implementation.
*/
#ifndef INCLUDED_AI_IMPORTER_DESC_H
#define INCLUDED_AI_IMPORTER_DESC_H
#pragma once
#ifndef AI_IMPORTER_DESC_H_INC
#define AI_IMPORTER_DESC_H_INC
/** Mixed set of flags for #aiImporterDesc, indicating some features
@ -140,4 +141,4 @@ Will return a NULL-pointer if no assigned importer desc. was found for the given
*/
ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImporterDesc( const char *extension );
#endif
#endif // AI_IMPORTER_DESC_H_INC

View File

@ -43,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Defines the aiLight data structure
*/
#ifndef __AI_LIGHT_H_INC__
#define __AI_LIGHT_H_INC__
#pragma once
#ifndef AI_LIGHT_H_INC
#define AI_LIGHT_H_INC
#include "types.h"
@ -250,7 +251,7 @@ struct aiLight
#ifdef __cplusplus
}
#endif
#endif
#endif // !! __AI_LIGHT_H_INC__
#endif // !! AI_LIGHT_H_INC

View File

@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file material.h
* @brief Defines the material system of the library
*/
#pragma once
#ifndef AI_MATERIAL_H_INC
#define AI_MATERIAL_H_INC

View File

@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Defines the C++ getters for the material system
*/
#pragma once
#ifndef AI_MATERIAL_INL_INC
#define AI_MATERIAL_INL_INC

View File

@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file matrix3x3.h
* @brief Definition of a 3x3 matrix, including operators when compiling in C++
*/
#ifndef AI_MATRIX3x3_H_INC
#define AI_MATRIX3x3_H_INC
#pragma once
#ifndef AI_MATRIX3X3_H_INC
#define AI_MATRIX3X3_H_INC
#include "./Compiler/pushpack1.h"
@ -179,4 +180,4 @@ struct aiMatrix3x3 {
#include "./Compiler/poppack1.h"
#endif // AI_MATRIX3x3_H_INC
#endif // AI_MATRIX3X3_H_INC

View File

@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file matrix3x3.inl
* @brief Inline implementation of the 3x3 matrix operators
*/
#ifndef AI_MATRIX3x3_INL_INC
#define AI_MATRIX3x3_INL_INC
#pragma once
#ifndef AI_MATRIX3X3_INL_INC
#define AI_MATRIX3X3_INL_INC
#ifdef __cplusplus
#include "matrix3x3.h"
@ -333,4 +334,4 @@ inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::FromToMatrix(const aiVector3t<T
#endif // __cplusplus
#endif // AI_MATRIX3x3_INL_INC
#endif // AI_MATRIX3X3_INL_INC

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file matrix4x4.h
* @brief 4x4 matrix structure, including operators when compiling in C++
*/
#pragma once
#ifndef AI_MATRIX4X4_H_INC
#define AI_MATRIX4X4_H_INC

View File

@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file matrix4x4.inl
* @brief Inline implementation of the 4x4 matrix operators
*/
#ifndef AI_MATRIX4x4_INL_INC
#define AI_MATRIX4x4_INL_INC
#pragma once
#ifndef AI_MATRIX4X4_INL_INC
#define AI_MATRIX4X4_INL_INC
#ifdef __cplusplus
@ -538,4 +539,4 @@ inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::FromToMatrix(const aiVector3t<T
}
#endif // __cplusplus
#endif // AI_MATRIX4x4_INL_INC
#endif // AI_MATRIX4X4_INL_INC

View File

@ -43,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Declares the data structures in which the imported geometry is
returned by ASSIMP: aiMesh, aiFace and aiBone data structures.
*/
#ifndef INCLUDED_AI_MESH_H
#define INCLUDED_AI_MESH_H
#pragma once
#ifndef AI_MESH_H_INC
#define AI_MESH_H_INC
#include "types.h"
@ -736,5 +737,5 @@ struct aiMesh
#ifdef __cplusplus
}
#endif //! extern "C"
#endif // __AI_MESH_H_INC
#endif // AI_MESH_H_INC

View File

@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file metadata.h
* @brief Defines the data structures for holding node meta information.
*/
#ifndef __AI_METADATA_H_INC__
#define __AI_METADATA_H_INC__
#pragma once
#ifndef AI_METADATA_H_INC
#define AI_METADATA_H_INC
#include <assert.h>
@ -246,6 +247,6 @@ struct aiMetadata
};
#endif // __AI_METADATA_H_INC__
#endif // AI_METADATA_H_INC

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file postprocess.h
* @brief Definitions for import post processing steps
*/
#pragma once
#ifndef AI_POSTPROCESS_H_INC
#define AI_POSTPROCESS_H_INC

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file quaternion.h
* @brief Quaternion structure, including operators when compiling in C++
*/
#pragma once
#ifndef AI_QUATERNION_H_INC
#define AI_QUATERNION_H_INC
@ -122,5 +123,4 @@ struct aiQuaternion {
#endif
#endif // AI_QUATERNION_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file quaternion.inl
* @brief Inline implementation of aiQuaterniont<TReal> operators
*/
#pragma once
#ifndef AI_QUATERNION_INL_INC
#define AI_QUATERNION_INL_INC
@ -280,4 +281,4 @@ inline aiVector3t<TReal> aiQuaterniont<TReal>::Rotate (const aiVector3t<TReal>&
}
#endif
#endif
#endif // AI_QUATERNION_INL_INC

View File

@ -38,12 +38,14 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
#pragma once
/** @file scene.h
* @brief Defines the data structures in which the imported scene is returned.
*/
#ifndef __AI_SCENE_H_INC__
#define __AI_SCENE_H_INC__
#pragma once
#ifndef AI_SCENE_H_INC
#define AI_SCENE_H_INC
#include "types.h"
#include "texture.h"
@ -425,4 +427,4 @@ struct aiScene
} //! namespace Assimp
#endif
#endif // __AI_SCENE_H_INC__
#endif // AI_SCENE_H_INC

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* pixels, and "compressed" textures, which are stored in a file format
* such as PNG or TGA.
*/
#pragma once
#ifndef AI_TEXTURE_H_INC
#define AI_TEXTURE_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file types.h
* Basic data types and primitives, such as vectors or colors.
*/
#pragma once
#ifndef AI_TYPES_H_INC
#define AI_TYPES_H_INC
@ -512,4 +513,5 @@ struct aiMemoryInfo
#include "quaternion.inl"
#include "matrix3x3.inl"
#include "matrix4x4.inl"
#endif
#endif // AI_TYPES_H_INC

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file vector2.h
* @brief 2D vector structure, including operators when compiling in C++
*/
#pragma once
#ifndef AI_VECTOR2D_H_INC
#define AI_VECTOR2D_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file vector2.inl
* @brief Inline implementation of aiVector2t<TReal> operators
*/
#pragma once
#ifndef AI_VECTOR2D_INL_INC
#define AI_VECTOR2D_INL_INC
@ -221,4 +222,5 @@ inline aiVector2t<TReal> operator - ( const aiVector2t<TReal>& v)
}
#endif
#endif
#endif // AI_VECTOR2D_INL_INC

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file vector3.h
* @brief 3D vector structure, including operators when compiling in C++
*/
#pragma once
#ifndef AI_VECTOR3D_H_INC
#define AI_VECTOR3D_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file vector3.inl
* @brief Inline implementation of aiVector3t<TReal> operators
*/
#pragma once
#ifndef AI_VECTOR3D_INL_INC
#define AI_VECTOR3D_INL_INC

View File

@ -43,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Functions to query the version of the Assimp runtime, check
* compile flags, ...
*/
#ifndef INCLUDED_AI_VERSION_H
#define INCLUDED_AI_VERSION_H
#pragma once
#ifndef AI_VERSION_H_INC
#define AI_VERSION_H_INC
#include "defs.h"
@ -102,4 +103,4 @@ ASSIMP_API unsigned int aiGetCompileFlags (void);
} // end extern "C"
#endif
#endif // !! #ifndef INCLUDED_AI_VERSION_H
#endif // !! #ifndef AI_VERSION_H_INC

View File

@ -288,9 +288,15 @@
/* Begin PBXProject section */
2A37F4A9FDCFA73011CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
};
buildConfigurationList = 26FC0AA90875C8B900E6366F /* Build configuration list for PBXProject "SimpleAssimpViewX" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 2A37F4AAFDCFA73011CA2CEA /* DisplayLinkAsyncMoviePlayer */;
projectDirPath = "";
projectRoot = "";
@ -390,7 +396,7 @@
"$(inherited)",
"\"$(SRCROOT)\"",
);
ONLY_ACTIVE_ARCH = NO;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = SimpleAssimpViewX;
VALID_ARCHS = "x86_64 i386";
WRAPPER_EXTENSION = app;

View File

@ -85,6 +85,7 @@ SET( TEST_SRCS
unit/utTextureTransform.cpp
unit/utTriangulate.cpp
unit/utVertexTriangleAdjacency.cpp
unit/utVersion.cpp
)
SOURCE_GROUP( tests FILES ${TEST_SRCS} )

View File

@ -7,9 +7,8 @@
// We need to be sure to have the same STL settings as Assimp
#include <assimp/cimport.h>
#include <gtest/gtest.h>
#include <memory>
#include <math.h>
#undef min

View File

@ -64,13 +64,10 @@ public:
}
protected:
Assimp::Exporter* ex;
Assimp::Importer* im;
};
// ------------------------------------------------------------------------------------------------
TEST_F(ColladaExportCamera, testExportCamera)
{
const char* file = "cameraExp.dae";
@ -82,13 +79,15 @@ TEST_F(ColladaExportCamera, testExportCamera)
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
const unsigned int origNumCams( pTest->mNumCameras );
float *origFOV = new float[ origNumCams ];
float *orifClipPlaneNear = new float[ origNumCams ];
float *orifClipPlaneFar = new float[ origNumCams ];
aiString *names = new aiString[ origNumCams ];
aiVector3D *pos = new aiVector3D[ origNumCams ];
std::unique_ptr<float[]> origFOV( new float[ origNumCams ] );
std::unique_ptr<float[]> orifClipPlaneNear( new float[ origNumCams ] );
std::unique_ptr<float[]> orifClipPlaneFar( new float[ origNumCams ] );
std::unique_ptr<aiString[]> names( new aiString[ origNumCams ] );
std::unique_ptr<aiVector3D[]> pos( new aiVector3D[ origNumCams ] );
for (size_t i = 0; i < origNumCams; i++) {
const aiCamera *orig = pTest->mCameras[ i ];
ASSERT_TRUE( orig != nullptr );
origFOV[ i ] = orig->mHorizontalFOV;
orifClipPlaneNear[ i ] = orig->mClipPlaneNear;
orifClipPlaneFar[ i ] = orig->mClipPlaneFar;
@ -114,15 +113,8 @@ TEST_F(ColladaExportCamera, testExportCamera)
EXPECT_FLOAT_EQ( pos[ i ].y,read->mPosition.y);
EXPECT_FLOAT_EQ( pos[ i ].z,read->mPosition.z);
}
delete [] origFOV;
delete [] orifClipPlaneNear;
delete [] orifClipPlaneFar;
delete [] names;
delete [] pos;
}
#endif
#endif // ASSIMP_BUILD_NO_EXPORT

View File

@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class ColladaExportLight : public ::testing::Test {
public:
virtual void SetUp()
{
ex = new Assimp::Exporter();
@ -63,8 +62,6 @@ public:
}
protected:
Assimp::Exporter* ex;
Assimp::Importer* im;
};
@ -79,7 +76,7 @@ TEST_F(ColladaExportLight, testExportLight)
ASSERT_TRUE(pTest->HasLights());
const unsigned int origNumLights( pTest->mNumLights );
aiLight *origLights = new aiLight[ origNumLights ];
std::unique_ptr<aiLight[]> origLights( new aiLight[ origNumLights ] );
std::vector<std::string> origNames;
for (size_t i = 0; i < origNumLights; i++) {
origNames.push_back( pTest->mLights[ i ]->mName.C_Str() );
@ -94,14 +91,11 @@ TEST_F(ColladaExportLight, testExportLight)
EXPECT_TRUE(imported->HasLights());
EXPECT_EQ( origNumLights,imported->mNumLights );
for(size_t i=0; i< origNumLights; i++){
for(size_t i=0; i< origNumLights; i++) {
const aiLight *orig = &origLights[ i ];
const aiLight *read = imported->mLights[i];
EXPECT_EQ(0,strncmp(origNames[ i ].c_str(),read->mName.C_Str(), origNames[ i ].size() ) );
EXPECT_EQ(orig->mType,read->mType);
EXPECT_EQ( 0,strncmp(origNames[ i ].c_str(),read->mName.C_Str(), origNames[ i ].size() ) );
EXPECT_EQ( orig->mType,read->mType);
EXPECT_FLOAT_EQ(orig->mAttenuationConstant,read->mAttenuationConstant);
EXPECT_FLOAT_EQ(orig->mAttenuationLinear,read->mAttenuationLinear);
EXPECT_NEAR(orig->mAttenuationQuadratic,read->mAttenuationQuadratic, 0.001f);
@ -121,12 +115,6 @@ TEST_F(ColladaExportLight, testExportLight)
EXPECT_NEAR(orig->mAngleInnerCone,read->mAngleInnerCone,0.001);
EXPECT_NEAR(orig->mAngleOuterCone,read->mAngleOuterCone,0.001);
}
delete [] origLights;
}
#endif
#endif // ASSIMP_BUILD_NO_EXPORT

View File

@ -46,15 +46,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace std;
using namespace Assimp;
class FindDegeneratesProcessTest : public ::testing::Test
{
class FindDegeneratesProcessTest : public ::testing::Test {
public:
virtual void SetUp();
virtual void TearDown();
protected:
aiMesh* mesh;
FindDegeneratesProcess* process;
};

View File

@ -50,12 +50,10 @@ using namespace Assimp;
class FindInvalidDataProcessTest : public ::testing::Test
{
public:
virtual void SetUp();
virtual void TearDown();
protected:
aiMesh* pcMesh;
FindInvalidDataProcess* piProcess;
};

View File

@ -41,14 +41,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "UnitTestPCH.h"
#include <GenVertexNormalsProcess.h>
using namespace std;
using namespace Assimp;
using namespace ::std;
using namespace ::Assimp;
class GenNormalsTest : public ::testing::Test
{
public:
virtual void SetUp();
virtual void TearDown();

View File

@ -46,15 +46,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <BaseImporter.h>
using namespace std;
using namespace Assimp;
using namespace ::std;
using namespace ::Assimp;
class ImporterTest : public ::testing::Test
{
public:
virtual void SetUp() { pImp = new Importer(); }
virtual void TearDown() { delete pImp; }
virtual void SetUp() {
pImp = new Importer();
}
virtual void TearDown() {
delete pImp;
}
protected:
Importer* pImp;
@ -109,7 +113,6 @@ static unsigned char InputData_abRawBlock[1310] = {
#define AIUT_DEF_ERROR_TEXT "sorry, this is a test"
static const aiImporterDesc desc = {
"UNIT TEST - IMPORTER",
"",
@ -123,11 +126,9 @@ static const aiImporterDesc desc = {
"apple mac linux windows"
};
class TestPlugin : public BaseImporter
{
public:
virtual bool CanRead(
const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*test*/) const
{

View File

@ -50,12 +50,10 @@ using namespace Assimp;
class JoinVerticesTest : public ::testing::Test
{
public:
virtual void SetUp();
virtual void TearDown();
protected:
JoinVerticesProcess* piProcess;
aiMesh* pcMesh;
};

View File

@ -43,18 +43,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h>
#include <LimitBoneWeightsProcess.h>
using namespace std;
using namespace Assimp;
class LimitBoneWeightsTest : public ::testing::Test {
public:
virtual void SetUp();
virtual void TearDown();
protected:
LimitBoneWeightsProcess* piProcess;
aiMesh* pcMesh;
};

View File

@ -43,19 +43,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h>
#include <MaterialSystem.h>
using namespace std;
using namespace Assimp;
using namespace ::std;
using namespace ::Assimp;
class MaterialSystemTest : public ::testing::Test
{
public:
virtual void SetUp() { this->pcMat = new aiMaterial(); }
virtual void TearDown() { delete this->pcMat; }
protected:
aiMaterial* pcMat;
};

View File

@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "UnitTestPCH.h"
#include <iostream>
using namespace Assimp;
using namespace ::Assimp;
class utMatrix3x3Test : public ::testing::Test {

View File

@ -0,0 +1,69 @@
/*-------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------*/
#include "UnitTestPCH.h"
#include <assimp/version.h>
class utVersion : public ::testing::Test {
// empty
};
TEST_F( utVersion, aiGetLegalStringTest ) {
const char *lv( aiGetLegalString() );
EXPECT_NE( lv, nullptr );
std::string text( lv );
size_t pos( text.find( std::string( "2016" ) ) );
EXPECT_NE( pos, std::string::npos );
}
TEST_F( utVersion, aiGetVersionMinorTest ) {
EXPECT_EQ( aiGetVersionMinor(), 3 );
}
TEST_F( utVersion, aiGetVersionMajorTest ) {
EXPECT_EQ( aiGetVersionMajor(), 3 );
}
TEST_F( utVersion, aiGetCompileFlagsTest ) {
EXPECT_NE( aiGetCompileFlags(), 0 );
}
TEST_F( utVersion, aiGetVersionRevisionTest ) {
EXPECT_NE( aiGetVersionRevision(), 0 );
}

View File

@ -7,6 +7,9 @@
objects = {
/* Begin PBXBuildFile section */
2DC891CA1D2CFA22001E0B0E /* D3MFImporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DC891C61D2CFA22001E0B0E /* D3MFImporter.cpp */; };
2DC891CB1D2CFA22001E0B0E /* D3MFOpcPackage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DC891C81D2CFA22001E0B0E /* D3MFOpcPackage.cpp */; };
2DC891D01D2CFA75001E0B0E /* C4DImporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DC891CE1D2CFA75001E0B0E /* C4DImporter.cpp */; };
7F79242A1AB43E20005A8E5D /* 3DSConverter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15221A74FC9C4B2AAA7306E3 /* 3DSConverter.cpp */; };
7F79242B1AB43E20005A8E5D /* 3DSExporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ECCBBF2D75A44335AB93C84A /* 3DSExporter.cpp */; };
7F79242C1AB43E20005A8E5D /* 3DSLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02E9476D129940BF84DE6682 /* 3DSLoader.cpp */; };
@ -245,6 +248,13 @@
2ACC87E846AE4E4A86E1AEF4 /* OptimizeMeshes.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = OptimizeMeshes.cpp; path = code/OptimizeMeshes.cpp; sourceTree = SOURCE_ROOT; };
2BE34AF1CE0C4767ACE21597 /* IFCLoader.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = IFCLoader.h; path = code/IFCLoader.h; sourceTree = SOURCE_ROOT; };
2C4D504725E540109530E254 /* PlyParser.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = PlyParser.cpp; path = code/PlyParser.cpp; sourceTree = SOURCE_ROOT; };
2DC891C61D2CFA22001E0B0E /* D3MFImporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = D3MFImporter.cpp; path = code/D3MFImporter.cpp; sourceTree = "<group>"; };
2DC891C71D2CFA22001E0B0E /* D3MFImporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = D3MFImporter.h; path = code/D3MFImporter.h; sourceTree = "<group>"; };
2DC891C81D2CFA22001E0B0E /* D3MFOpcPackage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = D3MFOpcPackage.cpp; path = code/D3MFOpcPackage.cpp; sourceTree = "<group>"; };
2DC891C91D2CFA22001E0B0E /* D3MFOpcPackage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = D3MFOpcPackage.h; path = code/D3MFOpcPackage.h; sourceTree = "<group>"; };
2DC891CD1D2CFA75001E0B0E /* ByteSwapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ByteSwapper.h; path = code/ByteSwapper.h; sourceTree = "<group>"; };
2DC891CE1D2CFA75001E0B0E /* C4DImporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = C4DImporter.cpp; path = code/C4DImporter.cpp; sourceTree = "<group>"; };
2DC891CF1D2CFA75001E0B0E /* C4DImporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = C4DImporter.h; path = code/C4DImporter.h; sourceTree = "<group>"; };
2DCF6F156A3A4B4C807E5368 /* SmoothingGroups.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = SmoothingGroups.h; path = code/SmoothingGroups.h; sourceTree = SOURCE_ROOT; };
2E7FD92FFCF441B0A60FC8B4 /* IFCCurve.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = IFCCurve.cpp; path = code/IFCCurve.cpp; sourceTree = SOURCE_ROOT; };
2F34A6A3C4104625A52BF7C2 /* cexport.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = cexport.h; path = include/assimp/cexport.h; sourceTree = SOURCE_ROOT; };
@ -735,6 +745,8 @@
2DC7AE369B84444B9649035D /* assimp */ = {
isa = PBXGroup;
children = (
2DC891CC1D2CFA44001E0B0E /* C4D */,
2DC891C51D2CFA01001E0B0E /* 3MF */,
DB181885BFCC44F594A1FA01 /* Source Files */,
628C9A9A9FA640B9AA1DAC09 /* Common */,
874C614E5BEB41419F0EEE1C /* Logging */,
@ -796,6 +808,26 @@
name = assimp;
sourceTree = "<group>";
};
2DC891C51D2CFA01001E0B0E /* 3MF */ = {
isa = PBXGroup;
children = (
2DC891C61D2CFA22001E0B0E /* D3MFImporter.cpp */,
2DC891C71D2CFA22001E0B0E /* D3MFImporter.h */,
2DC891C81D2CFA22001E0B0E /* D3MFOpcPackage.cpp */,
2DC891C91D2CFA22001E0B0E /* D3MFOpcPackage.h */,
);
name = 3MF;
sourceTree = "<group>";
};
2DC891CC1D2CFA44001E0B0E /* C4D */ = {
isa = PBXGroup;
children = (
2DC891CE1D2CFA75001E0B0E /* C4DImporter.cpp */,
2DC891CF1D2CFA75001E0B0E /* C4DImporter.h */,
);
name = C4D;
sourceTree = "<group>";
};
2E29D94CA6DA405EB4AF90E0 /* STL */ = {
isa = PBXGroup;
children = (
@ -877,6 +909,7 @@
628C9A9A9FA640B9AA1DAC09 /* Common */ = {
isa = PBXGroup;
children = (
2DC891CD1D2CFA75001E0B0E /* ByteSwapper.h */,
A58410FEAA884A2D8D73ACCE /* BaseImporter.cpp */,
32170F499DAC4E4595AF6D6B /* BaseImporter.h */,
FAB6BC13FCFE40F5801D0972 /* BaseProcess.cpp */,
@ -1640,6 +1673,7 @@
7F79244C1AB43E20005A8E5D /* DefaultIOSystem.cpp in Sources */,
7F7A93A81B65D0110094C4DA /* DDLNode.cpp in Sources */,
7F79244D1AB43E20005A8E5D /* DefaultLogger.cpp in Sources */,
2DC891D01D2CFA75001E0B0E /* C4DImporter.cpp in Sources */,
7F79244E1AB43E20005A8E5D /* Exporter.cpp in Sources */,
7F79244F1AB43E20005A8E5D /* FBXAnimation.cpp in Sources */,
7F7924501AB43E20005A8E5D /* FBXBinaryTokenizer.cpp in Sources */,
@ -1662,10 +1696,12 @@
7F79245F1AB43E20005A8E5D /* FindInstancesProcess.cpp in Sources */,
7F7924601AB43E20005A8E5D /* FindInvalidDataProcess.cpp in Sources */,
7F7924611AB43E20005A8E5D /* FixNormalsStep.cpp in Sources */,
2DC891CA1D2CFA22001E0B0E /* D3MFImporter.cpp in Sources */,
7F7924621AB43E20005A8E5D /* GenFaceNormalsProcess.cpp in Sources */,
7F7924631AB43E20005A8E5D /* GenVertexNormalsProcess.cpp in Sources */,
7F7924641AB43E20005A8E5D /* HMPLoader.cpp in Sources */,
7F7924651AB43E20005A8E5D /* IFCBoolean.cpp in Sources */,
2DC891CB1D2CFA22001E0B0E /* D3MFOpcPackage.cpp in Sources */,
7F7924661AB43E20005A8E5D /* IFCCurve.cpp in Sources */,
AFB7F85E1C882F8200D7B6E9 /* glTFImporter.cpp in Sources */,
7F7924671AB43E20005A8E5D /* IFCGeometry.cpp in Sources */,
@ -1787,7 +1823,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++98";
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@ -1821,6 +1858,7 @@
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -1835,7 +1873,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++98";
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@ -1868,6 +1907,7 @@
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "-ObjC";
@ -1882,7 +1922,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++98";
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@ -1914,6 +1955,7 @@
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "-ObjC";
@ -1928,7 +1970,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++98";
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@ -1960,6 +2003,7 @@
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "-ObjC";