Merge branch 'assimp:master' into updatedZip
commit
0642b9cadf
|
@ -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 ()
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue