Remove aiCreateAndRegisterDefaultMaterial, it's completely wrong
parent
a7c13eef2c
commit
c3d8464a37
|
@ -272,8 +272,6 @@ void aiReleaseImport( const aiScene* pScene)
|
|||
|
||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
|
||||
aiReleaseDefaultMaterial();
|
||||
|
||||
// find the importer associated with this data
|
||||
const ScenePrivateData* priv = ScenePriv(pScene);
|
||||
if( !priv || !priv->mOrigImporter) {
|
||||
|
|
|
@ -178,7 +178,6 @@ Importer::~Importer()
|
|||
{
|
||||
// Delete all import plugins
|
||||
DeleteImporterInstanceList(pimpl->mImporter);
|
||||
aiReleaseDefaultMaterial();
|
||||
|
||||
// Delete all post-processing plug-ins
|
||||
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++)
|
||||
|
@ -385,7 +384,6 @@ void Importer::FreeScene( )
|
|||
{
|
||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
|
||||
aiReleaseDefaultMaterial();
|
||||
delete pimpl->mScene;
|
||||
pimpl->mScene = NULL;
|
||||
|
||||
|
|
|
@ -387,26 +387,6 @@ aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
|
|||
return AI_SUCCESS;
|
||||
}
|
||||
|
||||
static aiMaterial *DefaultMaterial = nullptr;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Will return the default material.
|
||||
aiMaterial *aiCreateAndRegisterDefaultMaterial() {
|
||||
if (nullptr == DefaultMaterial) {
|
||||
DefaultMaterial = new aiMaterial;
|
||||
aiString s;
|
||||
s.Set(AI_DEFAULT_MATERIAL_NAME);
|
||||
DefaultMaterial->AddProperty(&s, AI_MATKEY_NAME);
|
||||
}
|
||||
|
||||
return DefaultMaterial;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Will return the default material.
|
||||
void aiReleaseDefaultMaterial() {
|
||||
DefaultMaterial = nullptr;
|
||||
}
|
||||
|
||||
static const unsigned int DefaultNumAllocated = 5;
|
||||
|
||||
|
|
|
@ -214,11 +214,10 @@ void STLImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
|
|||
|
||||
// create a single default material, using a white diffuse color for consistency with
|
||||
// other geometric types (e.g., PLY).
|
||||
aiMaterial* pcMat = aiCreateAndRegisterDefaultMaterial();
|
||||
/*aiMaterial* pcMat = new aiMaterial();
|
||||
aiMaterial* pcMat = new aiMaterial();
|
||||
aiString s;
|
||||
s.Set(AI_DEFAULT_MATERIAL_NAME);
|
||||
pcMat->AddProperty(&s, AI_MATKEY_NAME);*/
|
||||
pcMat->AddProperty(&s, AI_MATKEY_NAME);
|
||||
|
||||
aiColor4D clrDiffuse(ai_real(1.0),ai_real(1.0),ai_real(1.0),ai_real(1.0));
|
||||
if (bMatClr) {
|
||||
|
|
|
@ -1565,26 +1565,6 @@ C_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
|
|||
unsigned int* flags /*= NULL*/);
|
||||
#endif // !#ifdef __cplusplus
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Helper function to get all values pertaining to a particular
|
||||
* texture slot from a material structure.
|
||||
*
|
||||
* @return Pointer showing to the default material.
|
||||
*/
|
||||
// ---------------------------------------------------------------------------
|
||||
#ifdef __cplusplus
|
||||
ASSIMP_API aiMaterial *aiCreateAndRegisterDefaultMaterial(void);
|
||||
#else
|
||||
C_STRUCT aiMaterial *aiCreateAndRegisterDefaultMaterial(void);
|
||||
#endif // !#ifdef __cplusplus
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Helper function to release the default material instance, the
|
||||
* instance will not be destroyed.
|
||||
*/
|
||||
// ---------------------------------------------------------------------------
|
||||
ASSIMP_API void aiReleaseDefaultMaterial();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -129,18 +129,10 @@ TEST_F(MaterialSystemTest, testStringProperty) {
|
|||
EXPECT_STREQ("Hello, this is a small test", s.data);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
TEST_F(MaterialSystemTest, testDefaultMaterialAccess) {
|
||||
aiMaterial *mat = aiCreateAndRegisterDefaultMaterial();
|
||||
EXPECT_NE(nullptr, mat);
|
||||
aiReleaseDefaultMaterial();
|
||||
|
||||
delete mat;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
TEST_F(MaterialSystemTest, testMaterialNameAccess) {
|
||||
aiMaterial *mat = aiCreateAndRegisterDefaultMaterial();
|
||||
aiMaterial *mat = new aiMaterial();
|
||||
EXPECT_NE(nullptr, mat);
|
||||
|
||||
aiString name = mat->GetName();
|
||||
|
|
Loading…
Reference in New Issue