Merge branch 'master' into patch-13

pull/5505/head
Kim Kulling 2024-04-07 00:27:37 +02:00 committed by GitHub
commit 8970675da6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 126 additions and 357 deletions

View File

@ -563,9 +563,9 @@ 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/Cineware/includes")
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Cineware/includes")
IF (WIN32)
# pick the correct prebuilt library
IF(MSVC143)
SET(C4D_LIB_POSTFIX "_2022")
@ -583,7 +583,7 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
SET(C4D_LIB_POSTFIX "_2010")
ELSE()
MESSAGE( FATAL_ERROR
"C4D is currently only supported with MSVC 10, 11, 12, 14, 14.2, 14.3"
"C4D for Windows is currently only supported with MSVC 10, 11, 12, 14, 14.2, 14.3"
)
ENDIF()
@ -601,9 +601,20 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
# winsock and winmm are necessary (and undocumented) dependencies of Cineware SDK because
# it can be used to communicate with a running Cinema 4D instance
SET(C4D_EXTRA_LIBRARIES WSock32.lib Winmm.lib)
ELSEIF (APPLE)
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Cineware/libraries/osx")
SET(C4D_DEBUG_LIBRARIES
"${C4D_LIB_BASE_PATH}/debug/libcinewarelib.a"
"${C4D_LIB_BASE_PATH}/debug/libjpeglib.a"
)
SET(C4D_RELEASE_LIBRARIES
"${C4D_LIB_BASE_PATH}/release/libcinewarelib.a"
"${C4D_LIB_BASE_PATH}/release/libjpeglib.a"
)
ELSE ()
MESSAGE( FATAL_ERROR
"C4D is currently only available on Windows with Cineware SDK installed in contrib/Cineware"
"C4D is currently only available on Windows and macOS with Cineware SDK installed in contrib/Cineware"
)
ENDIF ()
ELSE ()

View File

@ -46,10 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// no #ifdefing here, Cinema4D support is carried out in a branch of assimp
// where it is turned on in the CMake settings.
#ifndef _MSC_VER
# error C4D support is currently MSVC only
#endif
#include "C4DImporter.h"
#include <memory>
#include <assimp/IOSystem.hpp>
@ -111,7 +107,7 @@ C4DImporter::C4DImporter() = default;
C4DImporter::~C4DImporter() = default;
// ------------------------------------------------------------------------------------------------
bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const {
bool C4DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
const std::string& extension = GetExtension(pFile);
if (extension == "c4d") {
return true;
@ -305,7 +301,7 @@ void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent) {
// based on Cineware sample code
while (object) {
const LONG type = object->GetType();
const Int32 type = object->GetType();
const Matrix& ml = object->GetMl();
aiNode* const nd = new aiNode();
@ -368,8 +364,8 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
PolygonObject* const polyObject = dynamic_cast<PolygonObject*>(object);
ai_assert(polyObject != nullptr);
const LONG pointCount = polyObject->GetPointCount();
const LONG polyCount = polyObject->GetPolygonCount();
const Int32 pointCount = polyObject->GetPointCount();
const Int32 polyCount = polyObject->GetPolygonCount();
if(!polyObject || !pointCount) {
LogWarn("ignoring mesh with zero vertices or faces");
return nullptr;
@ -391,7 +387,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
unsigned int vcount = 0;
// first count vertices
for (LONG i = 0; i < polyCount; i++)
for (Int32 i = 0; i < polyCount; i++)
{
vcount += 3;
@ -434,7 +430,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
}
// copy vertices and extra channels over and populate faces
for (LONG i = 0; i < polyCount; ++i, ++face) {
for (Int32 i = 0; i < polyCount; ++i, ++face) {
ai_assert(polys[i].a < pointCount && polys[i].a >= 0);
const Vector& pointA = points[polys[i].a];
verts->x = pointA.x;
@ -511,7 +507,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object) {
if (tangents_src) {
for(unsigned int k = 0; k < face->mNumIndices; ++k) {
LONG l;
Int32 l;
switch(k) {
case 0:
l = polys[i].a;

View File

@ -78,6 +78,8 @@ namespace Assimp {
// -------------------------------------------------------------------------------------------
class C4DImporter : public BaseImporter, public LogFunctions<C4DImporter> {
public:
C4DImporter();
~C4DImporter() override;
bool CanRead( const std::string& pFile, IOSystem*, bool checkSig) const override;
protected:

View File

@ -76,6 +76,53 @@ using namespace Util;
#define CONVERT_FBX_TIME(time) static_cast<double>(time) / 46186158000LL
static void correctRootTransform(const aiScene *scene) {
if (scene == nullptr) {
return;
}
if (scene->mMetaData == nullptr) {
return;
}
int32_t UpAxis = 1, UpAxisSign = 1, FrontAxis = 2, FrontAxisSign = 1, CoordAxis = 0, CoordAxisSign = 1;
double UnitScaleFactor = 1.0;
for (unsigned MetadataIndex = 0; MetadataIndex < scene->mMetaData->mNumProperties; ++MetadataIndex) {
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "UpAxis") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, UpAxis);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "UpAxisSign") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, UpAxisSign);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "FrontAxis") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, FrontAxis);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "FrontAxisSign") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, FrontAxisSign);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "CoordAxis") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, CoordAxis);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "CoordAxisSign") == 0) {
scene->mMetaData->Get<int32_t>(MetadataIndex, CoordAxisSign);
}
if (strcmp(scene->mMetaData->mKeys[MetadataIndex].C_Str(), "UnitScaleFactor") == 0) {
scene->mMetaData->Get<double>(MetadataIndex, UnitScaleFactor);
}
}
aiVector3D upVec, forwardVec, rightVec;
upVec[UpAxis] = UpAxisSign * static_cast<float>(UnitScaleFactor);
forwardVec[FrontAxis] = FrontAxisSign * static_cast<float>(UnitScaleFactor);
rightVec[CoordAxis] = CoordAxisSign * (float)UnitScaleFactor;
aiMatrix4x4 mat(rightVec.x, rightVec.y, rightVec.z, 0.0f,
upVec.x, upVec.y, upVec.z, 0.0f,
forwardVec.x, forwardVec.y, forwardVec.z, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
scene->mRootNode->mTransformation *= mat;
}
FBXConverter::FBXConverter(aiScene *out, const Document &doc, bool removeEmptyBones) :
defaultMaterialIndex(),
mMeshes(),
@ -133,6 +180,8 @@ FBXConverter::FBXConverter(aiScene *out, const Document &doc, bool removeEmptyBo
// need not contain geometry (i.e. camera animations, raw armatures).
if (out->mNumMeshes == 0) {
out->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
} else {
correctRootTransform(mSceneOut);
}
}
@ -3239,9 +3288,9 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name,
}
if (keyframeLists[TransformationComp_Rotation].size() > 0) {
InterpolateKeys(outRotations, keytimes, keyframeLists[TransformationComp_Rotation], AI_DEG_TO_RAD(defRotation), maxTime, minTime, rotOrder);
InterpolateKeys(outRotations, keytimes, keyframeLists[TransformationComp_Rotation], defRotation, maxTime, minTime, rotOrder);
} else {
aiQuaternion defQuat = EulerToQuaternion(AI_DEG_TO_RAD(defRotation), rotOrder);
aiQuaternion defQuat = EulerToQuaternion(defRotation, rotOrder);
for (size_t i = 0; i < keyCount; ++i) {
outRotations[i].mTime = CONVERT_FBX_TIME(keytimes[i]) * anim_fps;
outRotations[i].mValue = defQuat;
@ -3263,7 +3312,7 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name,
const aiVector3D& preRotation = PropertyGet<aiVector3D>(props, "PreRotation", ok);
if (ok && preRotation.SquareLength() > zero_epsilon) {
const aiQuaternion preQuat = EulerToQuaternion(AI_DEG_TO_RAD(preRotation), Model::RotOrder_EulerXYZ);
const aiQuaternion preQuat = EulerToQuaternion(preRotation, Model::RotOrder_EulerXYZ);
for (size_t i = 0; i < keyCount; ++i) {
outRotations[i].mValue = preQuat * outRotations[i].mValue;
}
@ -3271,7 +3320,7 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name,
const aiVector3D& postRotation = PropertyGet<aiVector3D>(props, "PostRotation", ok);
if (ok && postRotation.SquareLength() > zero_epsilon) {
const aiQuaternion postQuat = EulerToQuaternion(AI_DEG_TO_RAD(postRotation), Model::RotOrder_EulerXYZ);
const aiQuaternion postQuat = EulerToQuaternion(postRotation, Model::RotOrder_EulerXYZ);
for (size_t i = 0; i < keyCount; ++i) {
outRotations[i].mValue = outRotations[i].mValue * postQuat;
}

View File

@ -49,7 +49,7 @@ namespace HMP {
#include <assimp/Compiler/pushpack1.h>
#include <stdint.h>
// to make it easier for us, we test the magic word against both "endianesses"
// to make it easier for us, we test the magic word against both "endiannesses"
#define AI_HMP_MAGIC_NUMBER_BE_4 AI_MAKE_MAGIC("HMP4")
#define AI_HMP_MAGIC_NUMBER_LE_4 AI_MAKE_MAGIC("4PMH")

View File

@ -55,7 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp {
namespace MD2 {
// to make it easier for us, we test the magic word against both "endianesses"
// to make it easier for us, we test the magic word against both "endiannesses"
#define AI_MD2_MAGIC_NUMBER_BE AI_MAKE_MAGIC("IDP2")
#define AI_MD2_MAGIC_NUMBER_LE AI_MAKE_MAGIC("2PDI")

View File

@ -62,7 +62,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp {
namespace MD3 {
// to make it easier for us, we test the magic word against both "endianesses"
// to make it easier for us, we test the magic word against both "endiannesses"
#define AI_MD3_MAGIC_NUMBER_BE AI_MAKE_MAGIC("IDP3")
#define AI_MD3_MAGIC_NUMBER_LE AI_MAKE_MAGIC("3PDI")

View File

@ -61,7 +61,7 @@ http://themdcfile.planetwolfenstein.gamespy.com/MDC_File_Format.pdf
namespace Assimp {
namespace MDC {
// to make it easier for us, we test the magic word against both "endianesses"
// to make it easier for us, we test the magic word against both "endiannesses"
#define AI_MDC_MAGIC_NUMBER_BE AI_MAKE_MAGIC("CPDI")
#define AI_MDC_MAGIC_NUMBER_LE AI_MAKE_MAGIC("IDPC")

View File

@ -67,7 +67,7 @@ namespace Assimp {
namespace MDL {
// -------------------------------------------------------------------------------------
// to make it easier for us, we test the magic word against both "endianesses"
// to make it easier for us, we test the magic word against both "endiannesses"
// magic bytes used in Quake 1 MDL meshes
#define AI_MDL_MAGIC_NUMBER_BE AI_MAKE_MAGIC("IDPO")

View File

@ -59,9 +59,9 @@ namespace Assimp {
// ------------------------------------------------------------------------------------------------
// Worker function for exporting a scene to Wavefront OBJ. Prototyped and registered in Exporter.cpp
void ExportSceneObj(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/) {
void ExportSceneObj(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* props) {
// invoke the exporter
ObjExporter exporter(pFile, pScene);
ObjExporter exporter(pFile, pScene, false, props);
if (exporter.mOutput.fail() || exporter.mOutputMat.fail()) {
throw DeadlyExportError("output data creation failed. Most likely the file became too large: " + std::string(pFile));
@ -86,9 +86,9 @@ void ExportSceneObj(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene
// ------------------------------------------------------------------------------------------------
// Worker function for exporting a scene to Wavefront OBJ without the material file. Prototyped and registered in Exporter.cpp
void ExportSceneObjNoMtl(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* ) {
void ExportSceneObjNoMtl(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* props) {
// invoke the exporter
ObjExporter exporter(pFile, pScene, true);
ObjExporter exporter(pFile, pScene, true, props);
if (exporter.mOutput.fail() || exporter.mOutputMat.fail()) {
throw DeadlyExportError("output data creation failed. Most likely the file became too large: " + std::string(pFile));
@ -111,7 +111,7 @@ void ExportSceneObjNoMtl(const char* pFile,IOSystem* pIOSystem, const aiScene* p
static const std::string MaterialExt = ".mtl";
// ------------------------------------------------------------------------------------------------
ObjExporter::ObjExporter(const char* _filename, const aiScene* pScene, bool noMtl)
ObjExporter::ObjExporter(const char* _filename, const aiScene* pScene, bool noMtl, const ExportProperties* props)
: filename(_filename)
, pScene(pScene)
, vn()
@ -130,7 +130,10 @@ ObjExporter::ObjExporter(const char* _filename, const aiScene* pScene, bool noMt
mOutputMat.imbue(l);
mOutputMat.precision(ASSIMP_AI_REAL_TEXT_PRECISION);
WriteGeometryFile(noMtl);
WriteGeometryFile(
noMtl,
props == nullptr ? true : props->GetPropertyBool("bJoinIdenticalVertices", true)
);
if ( !noMtl ) {
WriteMaterialFile();
}
@ -255,14 +258,14 @@ void ObjExporter::WriteMaterialFile() {
}
}
void ObjExporter::WriteGeometryFile(bool noMtl) {
void ObjExporter::WriteGeometryFile(bool noMtl, bool merge_identical_vertices) {
WriteHeader(mOutput);
if (!noMtl)
mOutput << "mtllib " << GetMaterialLibName() << endl << endl;
// collect mesh geometry
aiMatrix4x4 mBase;
AddNode(pScene->mRootNode, mBase);
AddNode(pScene->mRootNode, mBase, merge_identical_vertices);
// write vertex positions with colors, if any
mVpMap.getKeys( vp );
@ -330,7 +333,7 @@ void ObjExporter::WriteGeometryFile(bool noMtl) {
}
// ------------------------------------------------------------------------------------------------
void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat) {
void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat, bool merge_identical_vertices) {
mMeshes.emplace_back();
MeshInstance& mesh = mMeshes.back();
@ -362,13 +365,14 @@ void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4
for(unsigned int a = 0; a < f.mNumIndices; ++a) {
const unsigned int idx = f.mIndices[a];
const unsigned int fi = merge_identical_vertices ? 0 : idx;
aiVector3D vert = mat * m->mVertices[idx];
if ( nullptr != m->mColors[ 0 ] ) {
aiColor4D col4 = m->mColors[ 0 ][ idx ];
face.indices[a].vp = mVpMap.getIndex({vert, aiColor3D(col4.r, col4.g, col4.b)});
face.indices[a].vp = mVpMap.getIndex({vert, aiColor3D(col4.r, col4.g, col4.b), fi});
} else {
face.indices[a].vp = mVpMap.getIndex({vert, aiColor3D(0,0,0)});
face.indices[a].vp = mVpMap.getIndex({vert, aiColor3D(0,0,0), fi});
}
if (m->mNormals) {
@ -388,21 +392,21 @@ void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4
}
// ------------------------------------------------------------------------------------------------
void ObjExporter::AddNode(const aiNode* nd, const aiMatrix4x4& mParent) {
void ObjExporter::AddNode(const aiNode* nd, const aiMatrix4x4& mParent, bool merge_identical_vertices) {
const aiMatrix4x4& mAbs = mParent * nd->mTransformation;
aiMesh *cm( nullptr );
for(unsigned int i = 0; i < nd->mNumMeshes; ++i) {
cm = pScene->mMeshes[nd->mMeshes[i]];
if (nullptr != cm) {
AddMesh(cm->mName, pScene->mMeshes[nd->mMeshes[i]], mAbs);
AddMesh(cm->mName, pScene->mMeshes[nd->mMeshes[i]], mAbs, merge_identical_vertices);
} else {
AddMesh(nd->mName, pScene->mMeshes[nd->mMeshes[i]], mAbs);
AddMesh(nd->mName, pScene->mMeshes[nd->mMeshes[i]], mAbs, merge_identical_vertices);
}
}
for(unsigned int i = 0; i < nd->mNumChildren; ++i) {
AddNode(nd->mChildren[i], mAbs);
AddNode(nd->mChildren[i], mAbs, merge_identical_vertices);
}
}

View File

@ -51,6 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include <map>
#include <assimp/Exporter.hpp>
struct aiScene;
struct aiNode;
struct aiMesh;
@ -63,7 +65,7 @@ namespace Assimp {
class ObjExporter {
public:
/// Constructor for a specific scene to export
ObjExporter(const char* filename, const aiScene* pScene, bool noMtl=false);
ObjExporter(const char* filename, const aiScene* pScene, bool noMtl=false, const ExportProperties* props = nullptr);
~ObjExporter();
std::string GetMaterialLibName();
std::string GetMaterialLibFileName();
@ -97,10 +99,10 @@ private:
void WriteHeader(std::ostringstream& out);
void WriteMaterialFile();
void WriteGeometryFile(bool noMtl=false);
void WriteGeometryFile(bool noMtl=false, bool merge_identical_vertices = false);
std::string GetMaterialName(unsigned int index);
void AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat);
void AddNode(const aiNode* nd, const aiMatrix4x4& mParent);
void AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat, bool merge_identical_vertices);
void AddNode(const aiNode* nd, const aiMatrix4x4& mParent, bool merge_identical_vertices);
private:
std::string filename;
@ -109,6 +111,7 @@ private:
struct vertexData {
aiVector3D vp;
aiColor3D vc; // OBJ does not support 4D color
uint32_t index = 0;
};
std::vector<aiVector3D> vn, vt;
@ -133,7 +136,7 @@ private:
if (a.vc.g > b.vc.g) return false;
if (a.vc.b < b.vc.b) return true;
if (a.vc.b > b.vc.b) return false;
return false;
return a.index < b.index;
}
};

View File

@ -1545,7 +1545,7 @@ Don't trust the input data! Check all offsets!
Mixed stuff for internal use by loaders, mostly documented (most of them are already included by <i>AssimpPCH.h</i>):
<ul>
<li><b>ByteSwapper</b> (<i>ByteSwapper.h</i>) - manual byte swapping stuff for binary loaders.</li>
<li><b>StreamReader</b> (<i>StreamReader.h</i>) - safe, endianess-correct, binary reading.</li>
<li><b>StreamReader</b> (<i>StreamReader.h</i>) - safe, endianness-correct, binary reading.</li>
<li><b>IrrXML</b> (<i>irrXMLWrapper.h</i>) - for XML-parsing (SAX.</li>
<li><b>CommentRemover</b> (<i>RemoveComments.h</i>) - remove single-line and multi-line comments from a text file.</li>
<li>fast_atof, strtoul10, strtoul16, SkipSpaceAndLineEnd, SkipToNextToken .. large family of low-level

View File

@ -263,7 +263,7 @@ struct ByteSwapper<T,false> {
};
// --------------------------------------------------------------------------------------------
template <bool SwapEndianess, typename T, bool RuntimeSwitch>
template <bool SwapEndianness, typename T, bool RuntimeSwitch>
struct Getter {
void operator() (T* inout, bool le) {
#ifdef AI_BUILD_BIG_ENDIAN
@ -278,12 +278,12 @@ struct Getter {
}
};
template <bool SwapEndianess, typename T>
struct Getter<SwapEndianess,T,false> {
template <bool SwapEndianness, typename T>
struct Getter<SwapEndianness,T,false> {
void operator() (T* inout, bool /*le*/) {
// static branch
ByteSwapper<T,(SwapEndianess && sizeof(T)>1)> () (inout);
ByteSwapper<T,(SwapEndianness && sizeof(T)>1)> () (inout);
}
};
} // end Intern

View File

@ -68,7 +68,7 @@ namespace Assimp {
*
* XXX switch from unsigned int for size types to size_t? or ptrdiff_t?*/
// --------------------------------------------------------------------------------------------
template <bool SwapEndianess = false, bool RuntimeSwitch = false>
template <bool SwapEndianness = false, bool RuntimeSwitch = false>
class StreamReader {
public:
using diff = size_t;
@ -84,7 +84,7 @@ public:
* reads from the current position to the end of the stream.
* @param le If @c RuntimeSwitch is true: specifies whether the
* stream is in little endian byte order. Otherwise the
* endianness information is contained in the @c SwapEndianess
* endianness information is contained in the @c SwapEndianness
* template parameter and this parameter is meaningless. */
StreamReader(std::shared_ptr<IOStream> stream, bool le = false) :
mStream(stream),
@ -291,7 +291,7 @@ public:
T f;
::memcpy(&f, mCurrent, sizeof(T));
Intern::Getter<SwapEndianess, T, RuntimeSwitch>()(&f, mLe);
Intern::Getter<SwapEndianness, T, RuntimeSwitch>()(&f, mLe);
mCurrent += sizeof(T);
return f;

View File

@ -65,7 +65,7 @@ namespace Assimp {
* stream is to be determined at runtime.
*/
// --------------------------------------------------------------------------------------------
template <bool SwapEndianess = false, bool RuntimeSwitch = false>
template <bool SwapEndianness = false, bool RuntimeSwitch = false>
class StreamWriter {
enum {
INITIAL_CAPACITY = 1024
@ -82,7 +82,7 @@ public:
continues at the current position of the stream cursor.
* @param le If @c RuntimeSwitch is true: specifies whether the
* stream is in little endian byte order. Otherwise the
* endianness information is defined by the @c SwapEndianess
* endianness information is defined by the @c SwapEndianness
* template parameter and this parameter is meaningless. */
StreamWriter(std::shared_ptr<IOStream> stream, bool le = false)
: stream(stream)
@ -260,7 +260,7 @@ public:
/** Generic write method. ByteSwap::Swap(T*) *must* be defined */
template <typename T>
void Put(T f) {
Intern :: Getter<SwapEndianess,T,RuntimeSwitch>() (&f, le);
Intern :: Getter<SwapEndianness,T,RuntimeSwitch>() (&f, le);
if (cursor + sizeof(T) >= buffer.size()) {
buffer.resize(cursor + sizeof(T));

View File

@ -1,29 +0,0 @@
------------------------------------------------------------------------------------
Open Asset Import Library (Assimp) Tools/Binaries for Windows
Release Notes
------------------------------------------------------------------------------------
Known Bugs & Limitations
========================
Viewer
- For files more than one embedded texture, only the first is loaded.
- Normals appear flipped from time to time when either of the normals-related menu items was hit.
- Alpha-sorting is implemented, but still causes artifacts when models are moved quickly.
- Several important texture file formats (such as GIF) are not supported.
- HUD is blurred on the right side. ATI/AMD hardware only.
Troubleshooting
===============
1. Missing d3dx9_42.dll?
Install the latest DirectX runtime or grab the file from somewhere (that's evil but mostly fine).
2. Application configuration not correct / missing msv*** DLLs?
(Re)install Microsoft Visual C++ 2005 SP1 Redistributable (x86 or x64, depending on your system)
3. Crashes immediately
You CPU lacks SSE2 support. Build Assimp from scratch to suit your CPU, sorry.

View File

@ -1,169 +0,0 @@
rem -----------------------------------------------------
rem Batch file to build zipped redist packages
rem Two different packages are built:
rem
rem assimp--<revision>-bin.zip
rem Binaries for x86 and x64
rem Command line reference
rem
rem assimp--<revision>-sdk.zip
rem Binaries for x86 and x64, Debug & Release
rem Libs for DLL build, x86 & 64, Debug & Release
rem Full SVN checkout exluding mkutil & port
rem
rem
rem PREREQUISITES:
rem -7za.exe (7zip standalone)
rem Download from http://www.7-zip.org/download.html
rem
rem -svnversion.exe (Subversion revision getter)
rem Download any command line SVN package
rem
rem -doxygen.exe (Doxygen client)
rem Download from www.doxygen.com
rem
rem -svn client
rem
rem NOTES:
rem ./bin must not have any local modifications
rem
rem -----------------------------------------------------
@echo off
color 4e
cls
rem -----------------------------------------------------
rem Setup file revision for build
rem -----------------------------------------------------
call mkrev.bat
rem -----------------------------------------------------
rem Build output file names
rem -----------------------------------------------------
cd ..\..\bin
svnversion > tmpfile.txt
SET /p REVISIONBASE= < tmpfile.txt
DEL /q tmpfile.txt
cd ..\packaging\windows-mkzip
SET VERSIONBASE=2.0.%REVISIONBASE%
SET OUT_SDK=assimp--%VERSIONBASE%-sdk
SET OUT_BIN=assimp--%VERSIONBASE%-bin
SET BINCFG_x86=release-dll_win32
SET BINCFG_x64=release-dll_x64
SET BINCFG_x86_DEBUG=debug-dll_win32
SET BINCFG_x64_DEBUG=debug-dll_x64
rem -----------------------------------------------------
rem Delete previous output directories
rem -----------------------------------------------------
RD /S /q final\
rem -----------------------------------------------------
rem Create output directories
rem -----------------------------------------------------
mkdir final\%OUT_BIN%\x86
mkdir final\%OUT_BIN%\x64
rem -----------------------------------------------------
rem Copy all executables to 'final-bin'
rem -----------------------------------------------------
copy /Y ..\..\bin\assimpview_%BINCFG_x86%\assimp_view.exe "final\%OUT_BIN%\x86\assimp_view.exe"
copy /Y ..\..\bin\assimpview_%BINCFG_x64%\assimp_view.exe "final\%OUT_BIN%\x64\assimp_view.exe"
copy /Y ..\..\bin\assimpcmd_%BINCFG_x86%\assimp.exe "final\%OUT_BIN%\x86\assimp.exe"
copy /Y ..\..\bin\assimpcmd_%BINCFG_x64%\assimp.exe "final\%OUT_BIN%\x64\assimp.exe"
copy /Y ..\..\bin\assimp_%BINCFG_x86%\Assimp32.dll "final\%OUT_BIN%\x86\Assimp32.dll"
copy /Y ..\..\bin\assimp_%BINCFG_x64%\Assimp64.dll "final\%OUT_BIN%\x64\Assimp64.dll"
copy ..\..\LICENSE final\%OUT_BIN%\LICENSE
copy ..\..\CREDITS final\%OUT_BIN%\CREDITS
copy bin_readme.txt final\%OUT_BIN%\README
copy bin_readme.txt final\%OUT_BIN%\README
copy ..\..\doc\AssimpCmdDoc_Html\AssimpCmdDoc.chm final\%OUT_BIN%\CommandLine.chm
rem -----------------------------------------------------
rem Do a clean export of the repository and build SDK
rem
rem We take the current revision and remove some stuff
rem that is nto yet ready to be published.
rem -----------------------------------------------------
svn export .\..\..\ .\final\%OUT_SDK%
mkdir final\%OUT_SDK%\doc\assimp_html
mkdir final\%OUT_SDK%\doc\assimpcmd_html
copy .\..\..\doc\AssimpDoc_Html\* final\%OUT_SDK%\doc\assimp_html
copy .\..\..\doc\AssimpCmdDoc_Html\* final\%OUT_SDK%\doc\assimpcmd_html
del final\%OUT_SDK%\doc\assimpcmd_html\AssimpCmdDoc.chm
del final\%OUT_SDK%\doc\assimp_html\AssimpDoc.chm
rem Copy doc to a suitable place
move final\%OUT_SDK%\doc\AssimpDoc_Html\AssimpDoc.chm final\%OUT_SDK%\Documentation.chm
move final\%OUT_SDK%\doc\AssimpCmdDoc_Html\AssimpCmdDoc.chm final\%OUT_SDK%\CommandLine.chm
rem Cleanup ./doc folder
del /q final\%OUT_SDK%\doc\Preamble.txt
RD /s /q final\%OUT_SDK%\doc\AssimpDoc_Html
RD /s /q final\%OUT_SDK%\doc\AssimpCmdDoc_Html
rem Insert 'dummy' files into empty folders
echo. > final\%OUT_SDK%\lib\dummy
echo. > final\%OUT_SDK%\obj\dummy
RD /s /q final\%OUT_SDK%\port\swig
rem Also, repackaging is not a must-have feature
RD /s /q final\%OUT_SDK%\packaging
rem Copy prebuilt libs
mkdir "final\%OUT_SDK%\lib\assimp_%BINCFG_x86%"
mkdir "final\%OUT_SDK%\lib\assimp_%BINCFG_x64%"
mkdir "final\%OUT_SDK%\lib\assimp_%BINCFG_x86_DEBUG%"
mkdir "final\%OUT_SDK%\lib\assimp_%BINCFG_x64_DEBUG%"
copy /Y ..\..\lib\assimp_%BINCFG_x86%\assimp.lib "final\%OUT_SDK%\lib\assimp_%BINCFG_x86%"
copy /Y ..\..\lib\assimp_%BINCFG_x64%\assimp.lib "final\%OUT_SDK%\lib\assimp_%BINCFG_x64%\"
copy /Y ..\..\lib\assimp_%BINCFG_x86_DEBUG%\assimp.lib "final\%OUT_SDK%\lib\assimp_%BINCFG_x86_DEBUG%\"
copy /Y ..\..\lib\assimp_%BINCFG_x64_DEBUG%\assimp.lib "final\%OUT_SDK%\lib\assimp_%BINCFG_x64_DEBUG%\"
rem Copy prebuilt DLLs
mkdir "final\%OUT_SDK%\bin\assimp_%BINCFG_x86%"
mkdir "final\%OUT_SDK%\bin\assimp_%BINCFG_x64%"
mkdir "final\%OUT_SDK%\bin\assimp_%BINCFG_x86_DEBUG%"
mkdir "final\%OUT_SDK%\bin\assimp_%BINCFG_x64_DEBUG%"
copy /Y ..\..\bin\assimp_%BINCFG_x86%\Assimp32.dll "final\%OUT_SDK%\bin\assimp_%BINCFG_x86%\"
copy /Y ..\..\bin\assimp_%BINCFG_x64%\Assimp64.dll "final\%OUT_SDK%\bin\assimp_%BINCFG_x64%\"
copy /Y ..\..\bin\assimp_%BINCFG_x86_DEBUG%\Assimp32d.dll "final\%OUT_SDK%\bin\assimp_%BINCFG_x86_DEBUG%\"
copy /Y ..\..\bin\assimp_%BINCFG_x64_DEBUG%\Assimp64d.dll "final\%OUT_SDK%\bin\assimp_%BINCFG_x64_DEBUG%\"
rem -----------------------------------------------------
rem Make final-bin.zip and final-sdk.zip
rem -----------------------------------------------------
IF NOT EXIST 7za.exe (
cls
echo You need to have 7zip standalone installed to
echo build ZIP archives. Download: http://www.7-zip.org/download.html
pause
) else (
7za.exe a -tzip "final\%OUT_BIN%.zip" ".\final\%OUT_BIN%"
7za.exe a -tzip "final\%OUT_SDK%.zip" ".\final\%OUT_SDK%"
)
rem OK. We should have the release packages now.

View File

@ -1,27 +0,0 @@
@echo off
rem -----------------------------------------------------
rem Tiny batch script to build the input file revision.h
rem revision.h contains the revision number of the wc.
rem It is included by assimp.rc.
rem -----------------------------------------------------
rem This is not very elegant, but it works.
rem ./bin shouldn't have any local modifications
svnversion > tmpfile.txt
set /p addtext= < tmpfile.txt
del /q tmpfile.txt
echo #define SVNRevision > tmpfile.txt
if exist ..\..\revision.h del /q ..\..\revision.h
for /f "delims=" %%l in (tmpfile.txt) Do (
for /f "delims=M:" %%r in ("%addtext%") Do (
echo %%l %%r >> ..\..\revision.h
)
)
del /q tmpfile.txt

View File

@ -44,9 +44,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cstdlib>
#include <gtest/gtest.h>
#if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__)
#define TMP_PATH "./"
#elif defined(__GNUC__) || defined(__clang__)
#define TMP_PATH "/tmp/"
#endif
#if defined(_MSC_VER)
#include <io.h>
#define TMP_PATH "./"
inline FILE* MakeTmpFile(char* tmplate)
{
auto pathtemplate = _mktemp(tmplate);
@ -60,7 +65,6 @@ inline FILE* MakeTmpFile(char* tmplate)
return fs;
}
#elif defined(__GNUC__) || defined(__clang__)
#define TMP_PATH "/tmp/"
inline FILE* MakeTmpFile(char* tmplate)
{
auto fd = mkstemp(tmplate);

View File

@ -1,57 +0,0 @@
@echo off
set "initialdir=%cd%"
goto:main
:exitsucc
cd /d "%initialdir%"
set initialdir=
set MSBUILD_15="C:\Program Files (x86)\Microsoft Visual Studio\2018\Professional\MSBuild\15.0\Bin\msbuild.exe"
set MSBUILD_14="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe"
if not "%VS150%"=="" set MSBUILD_15="%VS150%\MSBuild\15.0\Bin\msbuild.exe"
if /i %VS_VERSION%==2017 (
set MS_BUILD_EXE=%MSBUILD_15%
set PLATFORM_VER=v141
) else (
set MS_BUILD_EXE=%MSBUILD_14%
set PLATFORM_VER=v140
)
set MSBUILD=%MS_BUILD_EXE%
exit /b 0
:main
if not defined PLATFORM set "PLATFORM=x64"
::my work here is done?
set PATH_VSWHERE=C:\Program Files (x86)\Microsoft Visual Studio\Installer\
REM set PATH_STUDIO="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\"
for /f "usebackq tokens=*" %%i in (`"%PATH_VSWHERE%vswhere" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i
)
IF EXIST "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" set VS150=%InstallDir%\
set "CMAKE_GENERATOR=Visual Studio 15 2017 Win64"
if not "%VS150%"=="" call "%VS150%\VC\Auxiliary\Build\vcvarsall.bat" %PLATFORM% && echo found VS 2o17 && set PLATFORM_VER=v141 && set VS_VERSION=2017 && goto:exitsucc
set "CMAKE_GENERATOR=Visual Studio 14 2015 Win64"
if defined VS140COMNTOOLS call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o15 && set PLATFORM_VER=v140 && set VS_VERSION=2015 && goto:exitsucc
if defined VS130COMNTOOLS echo call ghostbusters... found lost VS version
set "CMAKE_GENERATOR=Visual Studio 12 2013 Win64"
if defined VS120COMNTOOLS call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o13 && set PLATFORM_VER=v120 && set VS_VERSION=2013 && goto:exitsucc
set "CMAKE_GENERATOR=Visual Studio 11 2012 Win64"
if defined VS110COMNTOOLS call "%VS110COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o12 && set PLATFORM_VER=v110 && set VS_VERSION=2012 && goto:exitsucc
set "CMAKE_GENERATOR=Visual Studio 10 2010 Win64"
if defined VS100COMNTOOLS call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" %PLATFORM% && echo found VS 2o1o && set PLATFORM_VER=v100 && set VS_VERSION=2010 && goto:exitsucc
goto:exitsucc

View File

@ -1,18 +0,0 @@
rem @echo off
setlocal
call build_env_win32.bat
set BUILD_CONFIG=release
set PLATFORM_CONFIG=x64
set MAX_CPU_CONFIG=4
set CONFIG_PARAMETER=/p:Configuration="%BUILD_CONFIG%"
set PLATFORM_PARAMETER=/p:Platform="%PLATFORM_CONFIG%"
set CPU_PARAMETER=/maxcpucount:%MAX_CPU_CONFIG%
set PLATFORM_TOOLSET=/p:PlatformToolset=%PLATFORM_VER%
pushd ..\..\
cmake CMakeLists.txt -G "Visual Studio 15 2017 Win64"
%MSBUILD% assimp.sln %CONFIG_PARAMETER% %PLATFORM_PARAMETER% %CPU_PARAMETER% %PLATFORM_TOOLSET%
popd
endlocal