Add configuration of text format precision
Define ASSIMP_AI_REAL_TEXT_PRECISION 8 when ai_real is float 16 when ai_real is doublepull/2517/head
parent
fb8ee5e301
commit
bf252c4452
|
@ -99,7 +99,7 @@ ColladaExporter::ColladaExporter( const aiScene* pScene, IOSystem* pIOSystem, co
|
||||||
, mFile(file) {
|
, mFile(file) {
|
||||||
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
||||||
mOutput.imbue( std::locale("C") );
|
mOutput.imbue( std::locale("C") );
|
||||||
mOutput.precision(16);
|
mOutput.precision(ASSIMP_AI_REAL_TEXT_PRECISION);
|
||||||
|
|
||||||
mScene = pScene;
|
mScene = pScene;
|
||||||
mSceneOwned = false;
|
mSceneOwned = false;
|
||||||
|
|
|
@ -126,9 +126,9 @@ ObjExporter::ObjExporter(const char* _filename, const aiScene* pScene, bool noMt
|
||||||
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
||||||
const std::locale& l = std::locale("C");
|
const std::locale& l = std::locale("C");
|
||||||
mOutput.imbue(l);
|
mOutput.imbue(l);
|
||||||
mOutput.precision(16);
|
mOutput.precision(ASSIMP_AI_REAL_TEXT_PRECISION);
|
||||||
mOutputMat.imbue(l);
|
mOutputMat.imbue(l);
|
||||||
mOutputMat.precision(16);
|
mOutputMat.precision(ASSIMP_AI_REAL_TEXT_PRECISION);
|
||||||
|
|
||||||
WriteGeometryFile(noMtl);
|
WriteGeometryFile(noMtl);
|
||||||
if ( !noMtl ) {
|
if ( !noMtl ) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool bina
|
||||||
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
||||||
const std::locale& l = std::locale("C");
|
const std::locale& l = std::locale("C");
|
||||||
mOutput.imbue(l);
|
mOutput.imbue(l);
|
||||||
mOutput.precision(16);
|
mOutput.precision(ASSIMP_AI_REAL_TEXT_PRECISION);
|
||||||
|
|
||||||
unsigned int faces = 0u, vertices = 0u, components = 0u;
|
unsigned int faces = 0u, vertices = 0u, components = 0u;
|
||||||
for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
|
for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ STLExporter::STLExporter(const char* _filename, const aiScene* pScene, bool expo
|
||||||
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
||||||
const std::locale& l = std::locale("C");
|
const std::locale& l = std::locale("C");
|
||||||
mOutput.imbue(l);
|
mOutput.imbue(l);
|
||||||
mOutput.precision(16);
|
mOutput.precision(ASSIMP_AI_REAL_TEXT_PRECISION);
|
||||||
if (binary) {
|
if (binary) {
|
||||||
char buf[80] = {0} ;
|
char buf[80] = {0} ;
|
||||||
buf[0] = 'A'; buf[1] = 's'; buf[2] = 's'; buf[3] = 'i'; buf[4] = 'm'; buf[5] = 'p';
|
buf[0] = 'A'; buf[1] = 's'; buf[2] = 's'; buf[3] = 'i'; buf[4] = 'm'; buf[5] = 'p';
|
||||||
|
|
|
@ -143,15 +143,15 @@ namespace {
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor for a specific scene to export
|
// Constructor for a specific scene to export
|
||||||
StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path,
|
StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path,
|
||||||
const std::string& file, const ExportProperties* pProperties):
|
const std::string& file, const ExportProperties* pProperties) :
|
||||||
mProperties(pProperties),mIOSystem(pIOSystem),mFile(file), mPath(path),
|
mProperties(pProperties), mIOSystem(pIOSystem), mFile(file), mPath(path),
|
||||||
mScene(pScene), endstr(";\n") {
|
mScene(pScene), endstr(";\n") {
|
||||||
CollectTrafos(pScene->mRootNode, trafos);
|
CollectTrafos(pScene->mRootNode, trafos);
|
||||||
CollectMeshes(pScene->mRootNode, meshes);
|
CollectMeshes(pScene->mRootNode, meshes);
|
||||||
|
|
||||||
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
||||||
mOutput.imbue( std::locale("C") );
|
mOutput.imbue(std::locale("C"));
|
||||||
mOutput.precision(16);
|
mOutput.precision(ASSIMP_AI_REAL_TEXT_PRECISION);
|
||||||
|
|
||||||
// start writing
|
// start writing
|
||||||
WriteFile();
|
WriteFile();
|
||||||
|
@ -166,7 +166,7 @@ void StepExporter::WriteFile()
|
||||||
mOutput.setf(std::ios::fixed);
|
mOutput.setf(std::ios::fixed);
|
||||||
// precision for double
|
// precision for double
|
||||||
// see http://stackoverflow.com/questions/554063/how-do-i-print-a-double-value-with-full-precision-using-cout
|
// see http://stackoverflow.com/questions/554063/how-do-i-print-a-double-value-with-full-precision-using-cout
|
||||||
mOutput.precision(16);
|
mOutput.precision(ASSIMP_AI_REAL_TEXT_PRECISION);
|
||||||
|
|
||||||
// standard color
|
// standard color
|
||||||
aiColor4D fColor;
|
aiColor4D fColor;
|
||||||
|
|
|
@ -113,7 +113,7 @@ XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const s
|
||||||
{
|
{
|
||||||
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
// make sure that all formatting happens using the standard, C locale and not the user's current locale
|
||||||
mOutput.imbue( std::locale("C") );
|
mOutput.imbue( std::locale("C") );
|
||||||
mOutput.precision(16);
|
mOutput.precision(ASSIMP_AI_REAL_TEXT_PRECISION);
|
||||||
|
|
||||||
// start writing
|
// start writing
|
||||||
WriteFile();
|
WriteFile();
|
||||||
|
@ -134,7 +134,7 @@ void XFileExporter::WriteFile()
|
||||||
{
|
{
|
||||||
// note, that all realnumber values must be comma separated in x files
|
// note, that all realnumber values must be comma separated in x files
|
||||||
mOutput.setf(std::ios::fixed);
|
mOutput.setf(std::ios::fixed);
|
||||||
mOutput.precision(16); // precision for double
|
mOutput.precision(ASSIMP_AI_REAL_TEXT_PRECISION); // precision for ai_real
|
||||||
|
|
||||||
// entry of writing the file
|
// entry of writing the file
|
||||||
WriteHeader();
|
WriteHeader();
|
||||||
|
|
|
@ -243,10 +243,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
typedef double ai_real;
|
typedef double ai_real;
|
||||||
typedef signed long long int ai_int;
|
typedef signed long long int ai_int;
|
||||||
typedef unsigned long long int ai_uint;
|
typedef unsigned long long int ai_uint;
|
||||||
|
#ifndef ASSIMP_AI_REAL_TEXT_PRECISION
|
||||||
|
#define ASSIMP_AI_REAL_TEXT_PRECISION 16
|
||||||
|
#endif // ASSIMP_AI_REAL_TEXT_PRECISION
|
||||||
#else // ASSIMP_DOUBLE_PRECISION
|
#else // ASSIMP_DOUBLE_PRECISION
|
||||||
typedef float ai_real;
|
typedef float ai_real;
|
||||||
typedef signed int ai_int;
|
typedef signed int ai_int;
|
||||||
typedef unsigned int ai_uint;
|
typedef unsigned int ai_uint;
|
||||||
|
#ifndef ASSIMP_AI_REAL_TEXT_PRECISION
|
||||||
|
#define ASSIMP_AI_REAL_TEXT_PRECISION 8
|
||||||
|
#endif // ASSIMP_AI_REAL_TEXT_PRECISION
|
||||||
#endif // ASSIMP_DOUBLE_PRECISION
|
#endif // ASSIMP_DOUBLE_PRECISION
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue