Fixed merge conflicts.
commit
860360bd86
|
@ -94,7 +94,11 @@ SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE PATH
|
|||
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE PATH
|
||||
"Path the tool executables are installed to." )
|
||||
|
||||
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Debug Postfitx for lib, samples and tools")
|
||||
IF (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING "Debug Postfix for lib, samples and tools")
|
||||
ELSE()
|
||||
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Debug Postfix for lib, samples and tools")
|
||||
ENDIF()
|
||||
|
||||
# Only generate this target if no higher-level project already has
|
||||
IF (NOT TARGET uninstall)
|
||||
|
|
|
@ -349,8 +349,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
|
|||
{
|
||||
if(!GetNextLine())
|
||||
{
|
||||
DefaultLogger::get()->error("AC3D: Unexpected EOF: surface is incomplete");
|
||||
break;
|
||||
throw DeadlyImportError("AC3D: Unexpected EOF: surface is incomplete");
|
||||
}
|
||||
if (TokenMatch(buffer,"mat",3))
|
||||
{
|
||||
|
|
|
@ -103,7 +103,7 @@ struct Image;
|
|||
// -------------------------------------------------------------------------------
|
||||
struct ID : ElemBase {
|
||||
|
||||
char name[24] WARN;
|
||||
char name[1024] WARN;
|
||||
short flag;
|
||||
};
|
||||
|
||||
|
|
|
@ -656,6 +656,11 @@ if ( MSVC )
|
|||
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
|
||||
endif ( MSVC )
|
||||
|
||||
if (APPLE)
|
||||
SET_TARGET_PROPERTIES( assimp PROPERTIES
|
||||
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}"
|
||||
)
|
||||
endif()
|
||||
if (UNZIP_FOUND)
|
||||
SET (unzip_compile_SRCS "")
|
||||
else (UNZIP_FOUND)
|
||||
|
|
|
@ -954,6 +954,9 @@ inline void LWOImporter::DoRecursiveVMAPAssignment(VMapEntry* base, unsigned int
|
|||
LWO::ReferrerList& refList = mCurLayer->mPointReferrers;
|
||||
unsigned int i;
|
||||
|
||||
if (idx >= base->abAssigned.size()) {
|
||||
throw DeadlyImportError("Bad index");
|
||||
}
|
||||
base->abAssigned[idx] = true;
|
||||
for (i = 0; i < numRead;++i) {
|
||||
base->rawData[idx*base->dims+i]= data[i];
|
||||
|
|
|
@ -310,6 +310,10 @@ void PLYImporter::ConvertMeshes(std::vector<PLY::Face>* avFaces,
|
|||
iNum += (unsigned int)(*avFaces)[aiSplit[p][i]].mIndices.size();
|
||||
}
|
||||
p_pcOut->mNumVertices = iNum;
|
||||
if( 0 == iNum ) { // nothing to do
|
||||
delete[] aiSplit; // cleanup
|
||||
return;
|
||||
}
|
||||
p_pcOut->mVertices = new aiVector3D[iNum];
|
||||
|
||||
if (!avColors->empty())
|
||||
|
@ -335,20 +339,25 @@ void PLYImporter::ConvertMeshes(std::vector<PLY::Face>* avFaces,
|
|||
for (unsigned int q = 0; q < p_pcOut->mFaces[iNum].mNumIndices;++q)
|
||||
{
|
||||
p_pcOut->mFaces[iNum].mIndices[q] = iVertex;
|
||||
p_pcOut->mVertices[iVertex] = (*avPositions)[(*avFaces)[*i].mIndices[q]];
|
||||
const size_t idx = ( *avFaces )[ *i ].mIndices[ q ];
|
||||
if( idx >= ( *avPositions ).size() ) {
|
||||
// out of border
|
||||
continue;
|
||||
}
|
||||
p_pcOut->mVertices[ iVertex ] = ( *avPositions )[ idx ];
|
||||
|
||||
if (!avColors->empty())
|
||||
p_pcOut->mColors[0][iVertex] = (*avColors)[(*avFaces)[*i].mIndices[q]];
|
||||
p_pcOut->mColors[ 0 ][ iVertex ] = ( *avColors )[ idx ];
|
||||
|
||||
if (!avTexCoords->empty())
|
||||
{
|
||||
const aiVector2D& vec = (*avTexCoords)[(*avFaces)[*i].mIndices[q]];
|
||||
const aiVector2D& vec = ( *avTexCoords )[ idx ];
|
||||
p_pcOut->mTextureCoords[0][iVertex].x = vec.x;
|
||||
p_pcOut->mTextureCoords[0][iVertex].y = vec.y;
|
||||
}
|
||||
|
||||
if (!avNormals->empty())
|
||||
p_pcOut->mNormals[iVertex] = (*avNormals)[(*avFaces)[*i].mIndices[q]];
|
||||
p_pcOut->mNormals[ iVertex ] = ( *avNormals )[ idx ];
|
||||
iVertex++;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,8 +75,9 @@ static const aiImporterDesc desc = {
|
|||
// 2) 4 byte face count
|
||||
// 3) 50 bytes per face
|
||||
bool IsBinarySTL(const char* buffer, unsigned int fileSize) {
|
||||
if (fileSize < 84)
|
||||
if( fileSize < 84 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint32_t faceCount = *reinterpret_cast<const uint32_t*>(buffer + 80);
|
||||
const uint32_t expectedBinaryFileSize = faceCount * 50 + 84;
|
||||
|
@ -99,7 +100,20 @@ bool IsAsciiSTL(const char* buffer, unsigned int fileSize) {
|
|||
if (buffer + 5 >= bufferEnd)
|
||||
return false;
|
||||
|
||||
return strncmp(buffer, "solid", 5) == 0;
|
||||
bool isASCII( strncmp( buffer, "solid", 5 ) == 0 );
|
||||
if( isASCII ) {
|
||||
// A lot of importers are write solid even if the file is binary. So we have to check for ASCII-characters.
|
||||
if( fileSize >= 500 ) {
|
||||
isASCII = true;
|
||||
for( unsigned int i = 0; i < 500; i++ ) {
|
||||
if( buffer[ i ] > 127 ) {
|
||||
isASCII = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return isASCII;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -122,20 +136,21 @@ bool STLImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool
|
|||
{
|
||||
const std::string extension = GetExtension(pFile);
|
||||
|
||||
if (extension == "stl")
|
||||
if( extension == "stl" ) {
|
||||
return true;
|
||||
else if (!extension.length() || checkSig) {
|
||||
if (!pIOHandler)
|
||||
} else if (!extension.length() || checkSig) {
|
||||
if( !pIOHandler ) {
|
||||
return true;
|
||||
}
|
||||
const char* tokens[] = {"STL","solid"};
|
||||
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,2);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const aiImporterDesc* STLImporter::GetInfo () const
|
||||
{
|
||||
const aiImporterDesc* STLImporter::GetInfo () const {
|
||||
return &desc;
|
||||
}
|
||||
|
||||
|
@ -273,7 +288,7 @@ void STLImporter::LoadASCIIFile()
|
|||
break;
|
||||
}
|
||||
// facet normal -0.13 -0.13 -0.98
|
||||
if (!strncmp(sz,"facet",5) && IsSpaceOrNewLine(*(sz+5))) {
|
||||
if (!strncmp(sz,"facet",5) && IsSpaceOrNewLine(*(sz+5)) && *(sz + 5) != '\0') {
|
||||
|
||||
if (faceVertexCounter != 3) {
|
||||
DefaultLogger::get()->warn("STL: A new facet begins but the old is not yet complete");
|
||||
|
|
|
@ -20,6 +20,7 @@ additional_dirs, ext_whitelist = [],[]
|
|||
# populate search directories and lists of allowed file extensions
|
||||
# depending on the platform we're running on.
|
||||
if os.name=='posix':
|
||||
additional_dirs.append('./')
|
||||
additional_dirs.append('/usr/lib/')
|
||||
additional_dirs.append('/usr/local/lib/')
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class PyAssimp3DViewer:
|
|||
pygame.init()
|
||||
pygame.display.set_caption(self.base_name)
|
||||
pygame.display.set_mode((w,h), pygame.OPENGL | pygame.DOUBLEBUF)
|
||||
|
||||
glutInit()
|
||||
self.prepare_shaders()
|
||||
|
||||
self.cameras = [DefaultCamera(w,h,fov)]
|
||||
|
|
Loading…
Reference in New Issue