- Update : Apply simple patch for debian-specific build-fixes: adapt architecture-macro.

- Bugfix : Fix a type in FixNormalStep.
- Bugfix : Fix a missing exception in Obj-Importer, texture coordinate import.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1079 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/2/head
kimmi 2011-09-23 16:45:17 +00:00
parent 487071be77
commit d5bd7009a6
4 changed files with 57 additions and 65 deletions

View File

@ -51,7 +51,7 @@ namespace Assimp
{
// ---------------------------------------------------------------------------
/** The FixInfacingNormalsProcess tries to deteermine whether the normal
/** The FixInfacingNormalsProcess tries to determine whether the normal
* vectors of an object are facing inwards. In this case they will be
* flipped.
*/

View File

@ -528,26 +528,34 @@ void WriteLogOpening(const std::string& file)
<< "."
<< aiGetVersionRevision()
#if defined(ASSIMP_BUILD_X86_32BIT_ARCHITECTURE)
<< " x86"
#elif defined(ASSIMP_BUILD_X86_64BIT_ARCHITECTURE)
<< " amd64"
#elif defined(ASSIMP_BUILD_IA_64BIT_ARCHITECTURE)
<< " itanium"
#elif defined(ASSIMP_BUILD_PPC_32BIT_ARCHITECTURE)
<< " ppc32"
#elif defined(ASSIMP_BUILD_ARM_32BIT_ARCHITECTURE)
<< " arm"
<< " "
#if defined(ASSIMP_BUILD_ARCHITECTURE)
<< ASSIMP_BUILD_ARCHITECTURE
#elif defined(_M_IX86) || defined(__x86_32__) || defined(__i386__)
<< "x86"
#elif defined(_M_X64) || defined(__x86_64__)
<< "amd64"
#elif defined(_M_IA64) || defined(__ia64__)
<< "itanium"
#elif defined(__ppc__) || defined(__powerpc__)
<< "ppc32"
#elif defined(__powerpc64__)
<< "ppc64"
#elif defined(__arm__)
<< "arm"
#else
# error unknown architecture
<< "<unknown architecture>"
#endif
#if defined(_MSC_VER)
<< " msvc"
<< " "
#if defined(ASSIMP_BUILD_COMPILER)
<< ASSIMP_BUILD_COMPILER
#elif defined(_MSC_VER)
<< "msvc"
#elif defined(__GNUC__)
<< " gcc"
<< "gcc"
#else
# error unknown compiler
<< "<unknown compiler>"
#endif
#ifndef NDEBUG

View File

@ -101,7 +101,7 @@ void ObjFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
if (NULL == file.get())
throw DeadlyImportError( "Failed to open file " + pFile + ".");
// Get the filesize and vaslidate it, throwing an exception when failes
// Get the file-size and validate it, throwing an exception when fails
size_t fileSize = file->FileSize();
if( fileSize < 16)
throw DeadlyImportError( "OBJ-file is too small.");
@ -189,10 +189,10 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile
pNode->mName = pObject->m_strObjName;
// If we have a parent node, store it
if (pParent != NULL)
appendChildToParentNode(pParent, pNode);
for ( unsigned int i=0; i< pObject->m_Meshes.size(); i++ )
{
unsigned int meshId = pObject->m_Meshes[ i ];
@ -358,9 +358,8 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
for ( size_t vertexIndex = 0, outVertexIndex = 0; vertexIndex < pSourceFace->m_pVertices->size(); vertexIndex++ )
{
const unsigned int vertex = pSourceFace->m_pVertices->at( vertexIndex );
if (vertex >= pModel->m_Vertices.size()) {
throw DeadlyImportError("OBJ: vertex index out of range");
}
if ( vertex >= pModel->m_Vertices.size() )
throw DeadlyImportError( "OBJ: vertex index out of range" );
pMesh->mVertices[ newIndex ] = pModel->m_Vertices[ vertex ];
@ -368,9 +367,8 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
if ( !pSourceFace->m_pNormals->empty() && !pModel->m_Normals.empty())
{
const unsigned int normal = pSourceFace->m_pNormals->at( vertexIndex );
if (normal >= pModel->m_Normals.size()) {
if ( normal >= pModel->m_Normals.size() )
throw DeadlyImportError("OBJ: vertex normal index out of range");
}
pMesh->mNormals[ newIndex ] = pModel->m_Normals[ normal ];
}
@ -384,6 +382,9 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
ai_assert( tex < pModel->m_TextureCoord.size() );
for ( size_t i=0; i < pMesh->GetNumUVChannels(); i++ )
{
if ( tex >= pModel->m_TextureCoord.size() )
throw DeadlyImportError("OBJ: texture coord index out of range");
aiVector2D coord2d = pModel->m_TextureCoord[ tex ];
pMesh->mTextureCoords[ i ][ newIndex ] = aiVector3D( coord2d.x, coord2d.y, 0.0 );
}
@ -395,21 +396,24 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
// Get destination face
aiFace *pDestFace = &pMesh->mFaces[ outIndex ];
const bool last = vertexIndex == pSourceFace->m_pVertices->size() - 1;
if (pSourceFace->m_PrimitiveType != aiPrimitiveType_LINE || !last) {
pDestFace->mIndices[ outVertexIndex++ ] = newIndex;
const bool last = ( vertexIndex == pSourceFace->m_pVertices->size() - 1 );
if (pSourceFace->m_PrimitiveType != aiPrimitiveType_LINE || !last)
{
pDestFace->mIndices[ outVertexIndex ] = newIndex;
outVertexIndex++;
}
if (pSourceFace->m_PrimitiveType == aiPrimitiveType_POINT) {
if (pSourceFace->m_PrimitiveType == aiPrimitiveType_POINT)
{
outIndex++;
outVertexIndex = 0;
}
else if (pSourceFace->m_PrimitiveType == aiPrimitiveType_LINE) {
else if (pSourceFace->m_PrimitiveType == aiPrimitiveType_LINE)
{
outVertexIndex = 0;
if(!last) {
if(!last)
outIndex++;
}
if (vertexIndex) {
if(!last) {

View File

@ -220,37 +220,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef _DEBUG
# define ASSIMP_BUILD_DEBUG
#endif
//////////////////////////////////////////////////////////////////////////
/* ASSIMP_BUILD_XXXX_NNBIT_ARCHITECTURE */
//////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER)
// See http://msdn.microsoft.com/en-us/library/b0084kay.
# if defined(_M_IX86)
# define ASSIMP_BUILD_X86_32BIT_ARCHITECTURE
# elif defined(_M_X64)
# define ASSIMP_BUILD_X86_64BIT_ARCHITECTURE
# elif defined(_M_IA64)
# define ASSIMP_BUILD_IA_64BIT_ARCHITECTURE
# else
# error unknown architecture
# endif
#elif defined(__GNUC__)
// See http://gcc.gnu.org/onlinedocs/cpp/Predefined-Macros.html.
# if defined(__x86_32__) || defined(__i386__)
# define ASSIMP_BUILD_X86_32BIT_ARCHITECTURE
# elif defined(__x86_64__)
# define ASSIMP_BUILD_X86_64BIT_ARCHITECTURE
# elif defined(__ppc__)
# define ASSIMP_BUILD_PPC_32BIT_ARCHITECTURE
# elif defined(__arm__)
# define ASSIMP_BUILD_ARM_32BIT_ARCHITECTURE
# else
# error "unknown architecture"
# endif
#else
# error unknown compiler
#endif
//////////////////////////////////////////////////////////////////////////
@ -271,9 +240,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_DEG_TO_RAD(x) (x*0.0174532925f)
#define AI_RAD_TO_DEG(x) (x*57.2957795f)
/* Support for big-endian builds on Mac OS X. */
#if defined(__APPLE__) && defined(__BIG_ENDIAN__)
#define AI_BUILD_BIG_ENDIAN
/* Support for big-endian builds */
#if defined(__BYTE_ORDER__)
# if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
# if !defined(__BIG_ENDIAN__)
# define __BIG_ENDIAN__
# endif
# else /* little endian */
# if defined (__BIG_ENDIAN__)
# undef __BIG_ENDIAN__
# endif
# endif
#endif
#if defined(__BIG_ENDIAN__)
# define AI_BUILD_BIG_ENDIAN
#endif
#endif // !! INCLUDED_AI_DEFINES_H