Merge pull request #546 from terziman/master

Minor improvments & bug fixes
pull/547/head
Alexander Gessler 2015-04-30 02:35:52 +02:00
commit 880cb473b0
17 changed files with 122 additions and 94 deletions

View File

@ -490,7 +490,7 @@ ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore* p, const char* szNam
{ {
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
PropertyMap* pp = reinterpret_cast<PropertyMap*>(p); PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
SetGenericProperty<int>(pp->ints,szName,value,NULL); SetGenericProperty<int>(pp->ints,szName,value);
ASSIMP_END_EXCEPTION_REGION(void); ASSIMP_END_EXCEPTION_REGION(void);
} }
@ -500,7 +500,7 @@ ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName,
{ {
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
PropertyMap* pp = reinterpret_cast<PropertyMap*>(p); PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
SetGenericProperty<float>(pp->floats,szName,value,NULL); SetGenericProperty<float>(pp->floats,szName,value);
ASSIMP_END_EXCEPTION_REGION(void); ASSIMP_END_EXCEPTION_REGION(void);
} }
@ -514,7 +514,7 @@ ASSIMP_API void aiSetImportPropertyString(aiPropertyStore* p, const char* szName
} }
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
PropertyMap* pp = reinterpret_cast<PropertyMap*>(p); PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
SetGenericProperty<std::string>(pp->strings,szName,std::string(st->C_Str()),NULL); SetGenericProperty<std::string>(pp->strings,szName,std::string(st->C_Str()));
ASSIMP_END_EXCEPTION_REGION(void); ASSIMP_END_EXCEPTION_REGION(void);
} }
@ -528,7 +528,7 @@ ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore* p, const char* szName
} }
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
PropertyMap* pp = reinterpret_cast<PropertyMap*>(p); PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
SetGenericProperty<aiMatrix4x4>(pp->matrices,szName,*mat,NULL); SetGenericProperty<aiMatrix4x4>(pp->matrices,szName,*mat);
ASSIMP_END_EXCEPTION_REGION(void); ASSIMP_END_EXCEPTION_REGION(void);
} }

View File

@ -513,6 +513,8 @@ struct Effect
// Scalar factory // Scalar factory
float mShininess, mRefractIndex, mReflectivity; float mShininess, mRefractIndex, mReflectivity;
float mTransparency; float mTransparency;
bool mHasTransparency;
bool mRGBTransparency;
// local params referring to each other by their SID // local params referring to each other by their SID
typedef std::map<std::string, Collada::EffectParam> ParamLibrary; typedef std::map<std::string, Collada::EffectParam> ParamLibrary;
@ -533,7 +535,9 @@ struct Effect
, mShininess (10.0f) , mShininess (10.0f)
, mRefractIndex (1.f) , mRefractIndex (1.f)
, mReflectivity (1.f) , mReflectivity (1.f)
, mTransparency (0.f) , mTransparency (1.f)
, mHasTransparency (false)
, mRGBTransparency(false)
, mDoubleSided (false) , mDoubleSided (false)
, mWireframe (false) , mWireframe (false)
, mFaceted (false) , mFaceted (false)

View File

@ -117,6 +117,7 @@ void ColladaLoader::SetupProperties(const Importer* pImp)
{ {
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0; noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
ignoreUpDirection = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION,0) != 0; ignoreUpDirection = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION,0) != 0;
invertTransparency = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_INVERT_TRANSPARENCY,0) != 0;
} }
@ -1338,11 +1339,25 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
mat.AddProperty( &effect.mRefractIndex, 1, AI_MATKEY_REFRACTI); mat.AddProperty( &effect.mRefractIndex, 1, AI_MATKEY_REFRACTI);
// transparency, a very hard one. seemingly not all files are following the // transparency, a very hard one. seemingly not all files are following the
// specification here .. but we can trick. // specification here (1.0 transparency => completly opaque)...
if (effect.mTransparency >= 0.f && effect.mTransparency < 1.f) { // therefore, we let the opportunity for the user to manually invert
effect.mTransparency = 1.f- effect.mTransparency; // the transparency if necessary and we add preliminary support for RGB_ZERO mode
mat.AddProperty( &effect.mTransparency, 1, AI_MATKEY_OPACITY ); if(effect.mTransparency >= 0.f && effect.mTransparency <= 1.f) {
mat.AddProperty( &effect.mTransparent, 1, AI_MATKEY_COLOR_TRANSPARENT ); // Trying some support for RGB_ZERO mode
if(effect.mRGBTransparency) {
effect.mTransparency = 1.f - effect.mTransparent.a;
}
// Global option
if(invertTransparency) {
effect.mTransparency = 1.f - effect.mTransparency;
}
// Is the material finally transparent ?
if (effect.mHasTransparency || effect.mTransparency < 1.f) {
mat.AddProperty( &effect.mTransparency, 1, AI_MATKEY_OPACITY );
mat.AddProperty( &effect.mTransparent, 1, AI_MATKEY_COLOR_TRANSPARENT );
}
} }
// add textures, if given // add textures, if given

View File

@ -241,6 +241,7 @@ protected:
bool noSkeletonMesh; bool noSkeletonMesh;
bool ignoreUpDirection; bool ignoreUpDirection;
bool invertTransparency;
/** Used by FindNameForNode() to generate unique node names */ /** Used by FindNameForNode() to generate unique node names */
unsigned int mNodeNameCounter; unsigned int mNodeNameCounter;

View File

@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER #ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER
#include <sstream>
#include "ColladaParser.h" #include "ColladaParser.h"
#include "fast_atof.h" #include "fast_atof.h"
#include "ParsingUtils.h" #include "ParsingUtils.h"
@ -1230,6 +1231,14 @@ void ColladaParser::ReadEffectProfileCommon( Collada::Effect& pEffect)
ReadEffectColor( pEffect.mReflective, pEffect.mTexReflective); ReadEffectColor( pEffect.mReflective, pEffect.mTexReflective);
} }
else if( IsElement( "transparent")) { else if( IsElement( "transparent")) {
pEffect.mHasTransparency = true;
// In RGB_ZERO mode, the transparency is interpreted in reverse, go figure...
if(::strcmp(mReader->getAttributeValueSafe("opaque"), "RGB_ZERO") == 0) {
// TODO: handle RGB_ZERO mode completely
pEffect.mRGBTransparency = true;
}
ReadEffectColor( pEffect.mTransparent,pEffect.mTexTransparent); ReadEffectColor( pEffect.mTransparent,pEffect.mTexTransparent);
} }
else if( IsElement( "shininess")) else if( IsElement( "shininess"))
@ -1987,12 +1996,12 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
break; break;
} }
} }
#ifdef ASSIMP_BUILD_DEBUG #ifdef ASSIMP_BUILD_DEBUG
if (primType != Prim_TriFans && primType != Prim_TriStrips) { if (primType != Prim_TriFans && primType != Prim_TriStrips) {
ai_assert(actualPrimitives == numPrimitives); ai_assert(actualPrimitives == numPrimitives);
} }
#endif #endif
// only when we're done reading all <p> tags (and thus know the final vertex count) can we commit the submesh // only when we're done reading all <p> tags (and thus know the final vertex count) can we commit the submesh
subgroup.mNumFaces = actualPrimitives; subgroup.mNumFaces = actualPrimitives;

View File

@ -513,34 +513,30 @@ ExportProperties::ExportProperties(const ExportProperties &other)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Set a configuration property // Set a configuration property
void ExportProperties :: SetPropertyInteger(const char* szName, int iValue, bool ExportProperties :: SetPropertyInteger(const char* szName, int iValue)
bool* bWasExisting /*= NULL*/)
{ {
SetGenericProperty<int>(mIntProperties, szName,iValue,bWasExisting); return SetGenericProperty<int>(mIntProperties, szName,iValue);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Set a configuration property // Set a configuration property
void ExportProperties :: SetPropertyFloat(const char* szName, float iValue, bool ExportProperties :: SetPropertyFloat(const char* szName, float iValue)
bool* bWasExisting /*= NULL*/)
{ {
SetGenericProperty<float>(mFloatProperties, szName,iValue,bWasExisting); return SetGenericProperty<float>(mFloatProperties, szName,iValue);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Set a configuration property // Set a configuration property
void ExportProperties :: SetPropertyString(const char* szName, const std::string& value, bool ExportProperties :: SetPropertyString(const char* szName, const std::string& value)
bool* bWasExisting /*= NULL*/)
{ {
SetGenericProperty<std::string>(mStringProperties, szName,value,bWasExisting); return SetGenericProperty<std::string>(mStringProperties, szName,value);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Set a configuration property // Set a configuration property
void ExportProperties :: SetPropertyMatrix(const char* szName, const aiMatrix4x4& value, bool ExportProperties :: SetPropertyMatrix(const char* szName, const aiMatrix4x4& value)
bool* bWasExisting /*= NULL*/)
{ {
SetGenericProperty<aiMatrix4x4>(mMatrixProperties, szName,value,bWasExisting); return SetGenericProperty<aiMatrix4x4>(mMatrixProperties, szName,value);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -49,22 +49,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
template <class T> template <class T>
inline void SetGenericProperty(std::map< unsigned int, T >& list, inline bool SetGenericProperty(std::map< unsigned int, T >& list,
const char* szName, const T& value, bool* bWasExisting = NULL) const char* szName, const T& value)
{ {
ai_assert(NULL != szName); ai_assert(NULL != szName);
const uint32_t hash = SuperFastHash(szName); const uint32_t hash = SuperFastHash(szName);
typename std::map<unsigned int, T>::iterator it = list.find(hash); typename std::map<unsigned int, T>::iterator it = list.find(hash);
if (it == list.end()) { if (it == list.end()) {
if (bWasExisting)
*bWasExisting = false;
list.insert(std::pair<unsigned int, T>( hash, value )); list.insert(std::pair<unsigned int, T>( hash, value ));
return; return false;
} }
(*it).second = value; (*it).second = value;
if (bWasExisting) return true;
*bWasExisting = true;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -925,42 +925,46 @@ void Importer::GetExtensionList(aiString& szOut) const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Set a configuration property // Set a configuration property
void Importer::SetPropertyInteger(const char* szName, int iValue, bool Importer::SetPropertyInteger(const char* szName, int iValue)
bool* bWasExisting /*= NULL*/)
{ {
bool existing;
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
SetGenericProperty<int>(pimpl->mIntProperties, szName,iValue,bWasExisting); existing = SetGenericProperty<int>(pimpl->mIntProperties, szName,iValue);
ASSIMP_END_EXCEPTION_REGION(void); ASSIMP_END_EXCEPTION_REGION(bool);
return existing;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Set a configuration property // Set a configuration property
void Importer::SetPropertyFloat(const char* szName, float iValue, bool Importer::SetPropertyFloat(const char* szName, float iValue)
bool* bWasExisting /*= NULL*/)
{ {
bool exising;
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
SetGenericProperty<float>(pimpl->mFloatProperties, szName,iValue,bWasExisting); exising = SetGenericProperty<float>(pimpl->mFloatProperties, szName,iValue);
ASSIMP_END_EXCEPTION_REGION(void); ASSIMP_END_EXCEPTION_REGION(bool);
return exising;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Set a configuration property // Set a configuration property
void Importer::SetPropertyString(const char* szName, const std::string& value, bool Importer::SetPropertyString(const char* szName, const std::string& value)
bool* bWasExisting /*= NULL*/)
{ {
bool exising;
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
SetGenericProperty<std::string>(pimpl->mStringProperties, szName,value,bWasExisting); exising = SetGenericProperty<std::string>(pimpl->mStringProperties, szName,value);
ASSIMP_END_EXCEPTION_REGION(void); ASSIMP_END_EXCEPTION_REGION(bool);
return exising;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Set a configuration property // Set a configuration property
void Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value, bool Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value)
bool* bWasExisting /*= NULL*/)
{ {
bool exising;
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
SetGenericProperty<aiMatrix4x4>(pimpl->mMatrixProperties, szName,value,bWasExisting); exising = SetGenericProperty<aiMatrix4x4>(pimpl->mMatrixProperties, szName,value);
ASSIMP_END_EXCEPTION_REGION(void); ASSIMP_END_EXCEPTION_REGION(bool);
return exising;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -563,7 +563,7 @@ bool MD3Importer::ReadMultipartFile()
// ensure we won't try to load ourselves recursively // ensure we won't try to load ourselves recursively
BatchLoader::PropertyMap props; BatchLoader::PropertyMap props;
SetGenericProperty( props.ints, AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART, 0, NULL); SetGenericProperty( props.ints, AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART, 0);
// now read these three files // now read these three files
BatchLoader batch(mIOHandler); BatchLoader batch(mIOHandler);

View File

@ -920,7 +920,7 @@ void SceneCombiner::MergeMaterials(aiMaterial** dest,
// Test if we already have a matching property // Test if we already have a matching property
const aiMaterialProperty* prop_exist; const aiMaterialProperty* prop_exist;
if(aiGetMaterialProperty(out, sprop->mKey.C_Str(), sprop->mType, sprop->mIndex, &prop_exist) != AI_SUCCESS) { if(aiGetMaterialProperty(out, sprop->mKey.C_Str(), sprop->mSemantic, sprop->mIndex, &prop_exist) != AI_SUCCESS) {
// If not, we add it to the new material // If not, we add it to the new material
aiMaterialProperty* prop = out->mProperties[out->mNumProperties] = new aiMaterialProperty(); aiMaterialProperty* prop = out->mProperties[out->mNumProperties] = new aiMaterialProperty();

View File

@ -255,7 +255,7 @@ inline int64_t strtol10_64(const char* in, const char** out = 0, unsigned int* m
// If you find any bugs, please send them to me, niko (at) irrlicht3d.org. // If you find any bugs, please send them to me, niko (at) irrlicht3d.org.
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
template <typename Real> template <typename Real>
inline const char* fast_atoreal_move( const char* c, Real& out, bool check_comma = true) inline const char* fast_atoreal_move(const char* c, Real& out, bool check_comma = true)
{ {
Real f = 0; Real f = 0;
@ -286,14 +286,14 @@ inline const char* fast_atoreal_move( const char* c, Real& out, bool check_comma
} }
if (!(c[0] >= '0' && c[0] <= '9') && if (!(c[0] >= '0' && c[0] <= '9') &&
!(c[0] == '.' && c[1] >= '0' && c[1] <= '9')) !((c[0] == '.' || (check_comma && c[0] == ',')) && c[1] >= '0' && c[1] <= '9'))
{ {
throw std::invalid_argument("Cannot parse string " throw std::invalid_argument("Cannot parse string "
"as real number: does not start with digit " "as real number: does not start with digit "
"or decimal point followed by digit."); "or decimal point followed by digit.");
} }
if (*c != '.') if (*c != '.' && (! check_comma || c[0] != ','))
{ {
f = static_cast<Real>( strtoul10_64 ( c, &c) ); f = static_cast<Real>( strtoul10_64 ( c, &c) );
} }

View File

@ -348,16 +348,14 @@ public:
* are defined in the aiConfig.g header (all constants share the * are defined in the aiConfig.g header (all constants share the
* prefix AI_CONFIG_XXX and are simple strings). * prefix AI_CONFIG_XXX and are simple strings).
* @param iValue New value of the property * @param iValue New value of the property
* @param bWasExisting Optional pointer to receive true if the * @return true if the property was set before. The new value replaces
* property was set before. The new value replaces the previous value * the previous value in this case.
* in this case.
* @note Property of different types (float, int, string ..) are kept * @note Property of different types (float, int, string ..) are kept
* on different stacks, so calling SetPropertyInteger() for a * on different stacks, so calling SetPropertyInteger() for a
* floating-point property has no effect - the loader will call * floating-point property has no effect - the loader will call
* GetPropertyFloat() to read the property, but it won't be there. * GetPropertyFloat() to read the property, but it won't be there.
*/ */
void SetPropertyInteger(const char* szName, int iValue, bool SetPropertyInteger(const char* szName, int iValue);
bool* bWasExisting = NULL);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Set a boolean configuration property. Boolean properties /** Set a boolean configuration property. Boolean properties
@ -366,30 +364,27 @@ public:
* #GetPropertyBool and vice versa. * #GetPropertyBool and vice versa.
* @see SetPropertyInteger() * @see SetPropertyInteger()
*/ */
void SetPropertyBool(const char* szName, bool value, bool* bWasExisting = NULL) { bool SetPropertyBool(const char* szName, bool value) {
SetPropertyInteger(szName,value,bWasExisting); return SetPropertyInteger(szName,value);
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Set a floating-point configuration property. /** Set a floating-point configuration property.
* @see SetPropertyInteger() * @see SetPropertyInteger()
*/ */
void SetPropertyFloat(const char* szName, float fValue, bool SetPropertyFloat(const char* szName, float fValue);
bool* bWasExisting = NULL);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Set a string configuration property. /** Set a string configuration property.
* @see SetPropertyInteger() * @see SetPropertyInteger()
*/ */
void SetPropertyString(const char* szName, const std::string& sValue, bool SetPropertyString(const char* szName, const std::string& sValue);
bool* bWasExisting = NULL);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Set a matrix configuration property. /** Set a matrix configuration property.
* @see SetPropertyInteger() * @see SetPropertyInteger()
*/ */
void SetPropertyMatrix(const char* szName, const aiMatrix4x4& sValue, bool SetPropertyMatrix(const char* szName, const aiMatrix4x4& sValue);
bool* bWasExisting = NULL);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Get a configuration property. /** Get a configuration property.

View File

@ -194,16 +194,14 @@ public:
* are defined in the aiConfig.g header (all constants share the * are defined in the aiConfig.g header (all constants share the
* prefix AI_CONFIG_XXX and are simple strings). * prefix AI_CONFIG_XXX and are simple strings).
* @param iValue New value of the property * @param iValue New value of the property
* @param bWasExisting Optional pointer to receive true if the * @return true if the property was set before. The new value replaces
* property was set before. The new value replaces the previous value * the previous value in this case.
* in this case.
* @note Property of different types (float, int, string ..) are kept * @note Property of different types (float, int, string ..) are kept
* on different stacks, so calling SetPropertyInteger() for a * on different stacks, so calling SetPropertyInteger() for a
* floating-point property has no effect - the loader will call * floating-point property has no effect - the loader will call
* GetPropertyFloat() to read the property, but it won't be there. * GetPropertyFloat() to read the property, but it won't be there.
*/ */
void SetPropertyInteger(const char* szName, int iValue, bool SetPropertyInteger(const char* szName, int iValue);
bool* bWasExisting = NULL);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Set a boolean configuration property. Boolean properties /** Set a boolean configuration property. Boolean properties
@ -212,30 +210,27 @@ public:
* #GetPropertyBool and vice versa. * #GetPropertyBool and vice versa.
* @see SetPropertyInteger() * @see SetPropertyInteger()
*/ */
void SetPropertyBool(const char* szName, bool value, bool* bWasExisting = NULL) { bool SetPropertyBool(const char* szName, bool value) {
SetPropertyInteger(szName,value,bWasExisting); return SetPropertyInteger(szName,value);
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Set a floating-point configuration property. /** Set a floating-point configuration property.
* @see SetPropertyInteger() * @see SetPropertyInteger()
*/ */
void SetPropertyFloat(const char* szName, float fValue, bool SetPropertyFloat(const char* szName, float fValue);
bool* bWasExisting = NULL);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Set a string configuration property. /** Set a string configuration property.
* @see SetPropertyInteger() * @see SetPropertyInteger()
*/ */
void SetPropertyString(const char* szName, const std::string& sValue, bool SetPropertyString(const char* szName, const std::string& sValue);
bool* bWasExisting = NULL);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Set a matrix configuration property. /** Set a matrix configuration property.
* @see SetPropertyInteger() * @see SetPropertyInteger()
*/ */
void SetPropertyMatrix(const char* szName, const aiMatrix4x4& sValue, bool SetPropertyMatrix(const char* szName, const aiMatrix4x4& sValue);
bool* bWasExisting = NULL);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Get a configuration property. /** Get a configuration property.

View File

@ -877,8 +877,24 @@ enum aiComponent
*/ */
#define AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION "IMPORT_IFC_CUSTOM_TRIANGULATION" #define AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION "IMPORT_IFC_CUSTOM_TRIANGULATION"
// ---------------------------------------------------------------------------
/** @brief Specifies whether the Collada loader will ignore the provided up direction.
*
* If this property is set to true, the up direction provided in the file header will
* be ignored and the file will be loaded as is.
* Property type: Bool. Default value: false.
*/
#define AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION "IMPORT_COLLADA_IGNORE_UP_DIRECTION" #define AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION "IMPORT_COLLADA_IGNORE_UP_DIRECTION"
// ---------------------------------------------------------------------------
/** @brief Specifies whether the Collada loader will invert the transparency value.
*
* If this property is set to true, the transparency value will be interpreted as the
* inverse of the usual transparency. This is useful because lots of exporters does
* not respect the standard and do the opposite of what is normally expected.
* Property type: Bool. Default value: false.
*/
#define AI_CONFIG_IMPORT_COLLADA_INVERT_TRANSPARENCY "IMPORT_COLLADA_INVERT_TRANSPARENCY"
// ---------- All the Export defines ------------ // ---------- All the Export defines ------------
@ -887,7 +903,6 @@ enum aiComponent
* Property type: Bool. Default value: false. * Property type: Bool. Default value: false.
*/ */
#define AI_CONFIG_EXPORT_XFILE_64BIT "EXPORT_XFILE_64BIT" #define AI_CONFIG_EXPORT_XFILE_64BIT "EXPORT_XFILE_64BIT"
#endif // !! AI_CONFIG_H_INC #endif // !! AI_CONFIG_H_INC

View File

@ -131,21 +131,19 @@ TEST_F(ImporterTest, testMemoryRead)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
TEST_F(ImporterTest, testIntProperty) TEST_F(ImporterTest, testIntProperty)
{ {
bool b; bool b = pImp->SetPropertyInteger("quakquak",1503);
pImp->SetPropertyInteger("quakquak",1503,&b);
EXPECT_FALSE(b); EXPECT_FALSE(b);
EXPECT_EQ(1503, pImp->GetPropertyInteger("quakquak",0)); EXPECT_EQ(1503, pImp->GetPropertyInteger("quakquak",0));
EXPECT_EQ(314159, pImp->GetPropertyInteger("not_there",314159)); EXPECT_EQ(314159, pImp->GetPropertyInteger("not_there",314159));
pImp->SetPropertyInteger("quakquak",1504,&b); b = pImp->SetPropertyInteger("quakquak",1504);
EXPECT_TRUE(b); EXPECT_TRUE(b);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
TEST_F(ImporterTest, testFloatProperty) TEST_F(ImporterTest, testFloatProperty)
{ {
bool b; bool b = pImp->SetPropertyFloat("quakquak",1503.f);
pImp->SetPropertyFloat("quakquak",1503.f,&b);
EXPECT_TRUE(!b); EXPECT_TRUE(!b);
EXPECT_EQ(1503.f, pImp->GetPropertyFloat("quakquak",0.f)); EXPECT_EQ(1503.f, pImp->GetPropertyFloat("quakquak",0.f));
EXPECT_EQ(314159.f, pImp->GetPropertyFloat("not_there",314159.f)); EXPECT_EQ(314159.f, pImp->GetPropertyFloat("not_there",314159.f));
@ -154,8 +152,7 @@ TEST_F(ImporterTest, testFloatProperty)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
TEST_F(ImporterTest, testStringProperty) TEST_F(ImporterTest, testStringProperty)
{ {
bool b; bool b = pImp->SetPropertyString("quakquak","test");
pImp->SetPropertyString("quakquak","test",&b);
EXPECT_TRUE(!b); EXPECT_TRUE(!b);
EXPECT_EQ("test", pImp->GetPropertyString("quakquak","weghwekg")); EXPECT_EQ("test", pImp->GetPropertyString("quakquak","weghwekg"));
EXPECT_EQ("ILoveYou", pImp->GetPropertyString("not_there","ILoveYou")); EXPECT_EQ("ILoveYou", pImp->GetPropertyString("not_there","ILoveYou"));

View File

@ -693,7 +693,7 @@ int CDisplay::FillDisplayList(void)
// fill in the first entry // fill in the first entry
TVITEMEX tvi; TVITEMEX tvi;
TVINSERTSTRUCT sNew; TVINSERTSTRUCT sNew;
tvi.pszText = "Model"; tvi.pszText = (char*) "Model";
tvi.cchTextMax = (int)strlen(tvi.pszText); tvi.cchTextMax = (int)strlen(tvi.pszText);
tvi.mask = TVIF_TEXT | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_HANDLE | TVIF_STATE; tvi.mask = TVIF_TEXT | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_HANDLE | TVIF_STATE;
tvi.state = TVIS_EXPANDED; tvi.state = TVIS_EXPANDED;

View File

@ -72,12 +72,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../../code/StringComparison.h" // ASSIMP_stricmp and ASSIMP_strincmp #include "../../code/StringComparison.h" // ASSIMP_stricmp and ASSIMP_strincmp
// in order for std::min and std::max to behave properly // in order for std::min and std::max to behave properly
/*#ifdef min #ifndef max
#undef min #define max(a,b) (((a) > (b)) ? (a) : (b))
#endif // max
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif // min #endif // min
#ifdef max
#undef max
#endif // min*/
#include <time.h> #include <time.h>