Fixed some minor issues in the AC loader. However, it still crashes with large and complicated models. Line handling is complete.
Moved the code to find degenerated primitives to a separate step that is not anymore active by default. The FindInvalidData-Step isn't active by default now. It hast a flag and must be explicitly requested. Added line and point handling code to the CalcTangentsStep - not yet tested. Added support for the Sense 8 (WorldToolKit) NFF file format. The format uses the same file extension as the "Neutral File Format" (and is implemented in the same loader). Seems to work well, added test files for it. Added itoa10 function - so we have itoa on all platforms. Small optimizations in the SortByPType step. Fixed the material validation: textured meshes without uv coords cause a warning now. Fixed a minor isses with the OFF loader. Added empty unit tests for the new steps - to be filled in the next days. Added SceneCombiner.cpp. It contains utilities to join meshes and scenes. The latter will be needed by the LWS loader (LWS files contain references to external LWO files and the LWO loader is already to complicated that it would make sense to add an additional code path to it). Mesh joining is needed by some pp steps, but the code has not yet been moved to its new location. Added WIP light & camera support to the ASE loader. Works for the moment, but there's much missing. ASE parser refactored, the code is still quite long but at least cleaner. Fixed a bug that caused ASE to import invalid texture coordinates. Makefiles and VC8 solution are up-to-date. The rest isn't. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@192 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
@@ -46,6 +46,63 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
namespace Assimp
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// itoa is not consistently available on all platforms so it is quite useful
|
||||
// to have a small replacement function here. No need to use a full sprintf()
|
||||
// if we just want to print a number ...
|
||||
// @param out Output buffer
|
||||
// @param max Maximum number of characters to be written, including '\0'
|
||||
// @param number Number to be written
|
||||
// @return Number of bytes written. Including '\0'.
|
||||
// ---------------------------------------------------------------------------
|
||||
inline unsigned int itoa10( char* out, unsigned int max, int32_t number)
|
||||
{
|
||||
ai_assert(NULL != out);
|
||||
|
||||
static const char lookup[] = {'0','1','2','3','4','5','6','7','8','9'};
|
||||
|
||||
// write the unary minus to indicate we have a negative number
|
||||
unsigned int written = 1u;
|
||||
if (number < 0 && written < max)
|
||||
{
|
||||
*out++ = '-';
|
||||
++written;
|
||||
}
|
||||
|
||||
// We begin with the largest number that is not zero.
|
||||
int32_t cur = 1000000000; // 2147483648
|
||||
bool mustPrint = false;
|
||||
while (cur > 0 && written <= max)
|
||||
{
|
||||
unsigned int digit = number / cur;
|
||||
if (digit > 0 || mustPrint || 1 == cur)
|
||||
{
|
||||
// print all future zero's from now
|
||||
mustPrint = true;
|
||||
*out++ = lookup[digit];
|
||||
|
||||
++written;
|
||||
number -= digit*10;
|
||||
}
|
||||
cur /= 10;
|
||||
}
|
||||
|
||||
// append a terminal zero
|
||||
*out++ = '\0';
|
||||
return written;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Secure template overload
|
||||
// The compiler should choose this function if he is able to determine the
|
||||
// size of the array automatically.
|
||||
// ---------------------------------------------------------------------------
|
||||
template <unsigned int length>
|
||||
inline unsigned int itoa10( char(& out)[length], int32_t number)
|
||||
{
|
||||
return itoa10(out,length,number);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** \brief Helper function to do platform independent string comparison.
|
||||
*
|
||||
@@ -76,6 +133,9 @@ inline int ASSIMP_stricmp(const char *s1, const char *s2)
|
||||
#endif
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** \brief Case independent comparison of two std::strings
|
||||
*/
|
||||
// ---------------------------------------------------------------------------
|
||||
inline int ASSIMP_stricmp(const std::string& a, const std::string& b)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user