- extract MaterialHelper and move all of its members to aiMaterial in /include.

- pull in IOhannes' patch to set the gcc default visibility for all symbols to NO and to mark ASSIMP_API with __attribute__ ((visibility("default"))).
- drop unneeded ASSIMP_API from most internal classes in /code, we just need to keep some exports on Windows to keep AssimpView alive.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1066 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/2/head
aramis_acg 2011-08-22 20:22:51 +00:00
parent 9f32504792
commit 9d85c8834d
111 changed files with 1867 additions and 1935 deletions

View File

@ -100,6 +100,9 @@ IF ( NO_EXPORT )
MESSAGE( STATUS "Build an import-only version of Assimp." ) MESSAGE( STATUS "Build an import-only version of Assimp." )
ENDIF( NO_EXPORT ) ENDIF( NO_EXPORT )
## hide all not-exported symbols
ADD_DEFINITIONS( -fvisibility=hidden )
ADD_SUBDIRECTORY( code/ ) ADD_SUBDIRECTORY( code/ )
SET ( BUILD_ASSIMP_TOOLS ON CACHE BOOL SET ( BUILD_ASSIMP_TOOLS ON CACHE BOOL
"If the supplementary tools for Assimp are built in addition to the library." "If the supplementary tools for Assimp are built in addition to the library."

View File

@ -182,7 +182,7 @@ void Discreet3DSImporter::MakeUnique(D3DS::Mesh& sMesh)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Convert a 3DS texture to texture keys in an aiMaterial // Convert a 3DS texture to texture keys in an aiMaterial
void CopyTexture(MaterialHelper& mat, D3DS::Texture& texture, aiTextureType type) void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type)
{ {
// Setup the texture name // Setup the texture name
aiString tex; aiString tex;
@ -214,7 +214,7 @@ void CopyTexture(MaterialHelper& mat, D3DS::Texture& texture, aiTextureType type
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Convert a 3DS material to an aiMaterial // Convert a 3DS material to an aiMaterial
void Discreet3DSImporter::ConvertMaterial(D3DS::Material& oldMat, void Discreet3DSImporter::ConvertMaterial(D3DS::Material& oldMat,
MaterialHelper& mat) aiMaterial& mat)
{ {
// NOTE: Pass the background image to the viewer by bypassing the // NOTE: Pass the background image to the viewer by bypassing the
// material system. This is an evil hack, never do it again! // material system. This is an evil hack, never do it again!
@ -813,7 +813,7 @@ void Discreet3DSImporter::ConvertScene(aiScene* pcOut)
// ... and convert the 3DS materials to aiMaterial's // ... and convert the 3DS materials to aiMaterial's
for (unsigned int i = 0; i < pcOut->mNumMaterials;++i) for (unsigned int i = 0; i < pcOut->mNumMaterials;++i)
{ {
MaterialHelper* pcNew = new MaterialHelper(); aiMaterial* pcNew = new aiMaterial();
ConvertMaterial(mScene->mMaterials[i],*pcNew); ConvertMaterial(mScene->mMaterials[i],*pcNew);
pcOut->mMaterials[i] = pcNew; pcOut->mMaterials[i] = pcNew;
} }

View File

@ -52,7 +52,7 @@ struct aiNode;
#include "3DSHelper.h" #include "3DSHelper.h"
namespace Assimp { namespace Assimp {
class MaterialHelper;
using namespace D3DS; using namespace D3DS;
@ -101,7 +101,7 @@ protected:
/** Converts a temporary material to the outer representation /** Converts a temporary material to the outer representation
*/ */
void ConvertMaterial(D3DS::Material& p_cMat, void ConvertMaterial(D3DS::Material& p_cMat,
MaterialHelper& p_pcOut); aiMaterial& p_pcOut);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Read a chunk /** Read a chunk

View File

@ -375,7 +375,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
// Convert a material from AC3DImporter::Material to aiMaterial // Convert a material from AC3DImporter::Material to aiMaterial
void AC3DImporter::ConvertMaterial(const Object& object, void AC3DImporter::ConvertMaterial(const Object& object,
const Material& matSrc, const Material& matSrc,
MaterialHelper& matDest) aiMaterial& matDest)
{ {
aiString s; aiString s;
@ -422,7 +422,7 @@ void AC3DImporter::ConvertMaterial(const Object& object,
// Converts the loaded data to the internal verbose representation // Converts the loaded data to the internal verbose representation
aiNode* AC3DImporter::ConvertObjectSection(Object& object, aiNode* AC3DImporter::ConvertObjectSection(Object& object,
std::vector<aiMesh*>& meshes, std::vector<aiMesh*>& meshes,
std::vector<MaterialHelper*>& outMaterials, std::vector<aiMaterial*>& outMaterials,
const std::vector<Material>& materials, const std::vector<Material>& materials,
aiNode* parent) aiNode* parent)
{ {
@ -463,7 +463,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
// default material if all objects of the file contain points // default material if all objects of the file contain points
// and no faces. // and no faces.
mesh->mMaterialIndex = 0; mesh->mMaterialIndex = 0;
outMaterials.push_back(new MaterialHelper()); outMaterials.push_back(new aiMaterial());
ConvertMaterial(object, materials[0], *outMaterials.back()); ConvertMaterial(object, materials[0], *outMaterials.back());
} }
else else
@ -548,7 +548,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
meshes.push_back(mesh); meshes.push_back(mesh);
mesh->mMaterialIndex = (unsigned int)outMaterials.size(); mesh->mMaterialIndex = (unsigned int)outMaterials.size();
outMaterials.push_back(new MaterialHelper()); outMaterials.push_back(new aiMaterial());
ConvertMaterial(object, materials[mat], *outMaterials.back()); ConvertMaterial(object, materials[mat], *outMaterials.back());
// allocate storage for vertices and normals // allocate storage for vertices and normals
@ -811,7 +811,7 @@ void AC3DImporter::InternReadFile( const std::string& pFile,
std::vector<aiMesh*> meshes; std::vector<aiMesh*> meshes;
meshes.reserve(mNumMeshes); meshes.reserve(mNumMeshes);
std::vector<MaterialHelper*> omaterials; std::vector<aiMaterial*> omaterials;
materials.reserve(mNumMeshes); materials.reserve(mNumMeshes);
// generate a dummy root if there are multiple objects on the top layer // generate a dummy root if there are multiple objects on the top layer

View File

@ -222,7 +222,7 @@ private:
* @param Scenegraph node for the object */ * @param Scenegraph node for the object */
aiNode* ConvertObjectSection(Object& object, aiNode* ConvertObjectSection(Object& object,
std::vector<aiMesh*>& meshes, std::vector<aiMesh*>& meshes,
std::vector<MaterialHelper*>& outMaterials, std::vector<aiMaterial*>& outMaterials,
const std::vector<Material>& materials, const std::vector<Material>& materials,
aiNode* parent = NULL); aiNode* parent = NULL);
@ -233,7 +233,7 @@ private:
* @param matDest Destination material to be filled */ * @param matDest Destination material to be filled */
void ConvertMaterial(const Object& object, void ConvertMaterial(const Object& object,
const Material& matSrc, const Material& matSrc,
MaterialHelper& matDest); aiMaterial& matDest);
private: private:

View File

@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "ASELoader.h" #include "ASELoader.h"
#include "MaterialSystem.h"
#include "StringComparison.h" #include "StringComparison.h"
#include "SkeletonMeshBuilder.h" #include "SkeletonMeshBuilder.h"
#include "TargetAnimation.h" #include "TargetAnimation.h"
@ -788,7 +787,7 @@ void ASEImporter::BuildUniqueRepresentation(ASE::Mesh& mesh) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Copy a texture from the ASE structs to the output material // Copy a texture from the ASE structs to the output material
void CopyASETexture(MaterialHelper& mat, ASE::Texture& texture, aiTextureType type) void CopyASETexture(aiMaterial& mat, ASE::Texture& texture, aiTextureType type)
{ {
// Setup the texture name // Setup the texture name
aiString tex; aiString tex;
@ -810,7 +809,7 @@ void ASEImporter::ConvertMaterial(ASE::Material& mat)
// LARGE TODO: Much code her is copied from 3DS ... join them maybe? // LARGE TODO: Much code her is copied from 3DS ... join them maybe?
// Allocate the output material // Allocate the output material
mat.pcInstance = new MaterialHelper(); mat.pcInstance = new aiMaterial();
// At first add the base ambient color of the // At first add the base ambient color of the
// scene to the material // scene to the material

View File

@ -51,7 +51,7 @@ struct aiNode;
#include "ASEParser.h" #include "ASEParser.h"
namespace Assimp { namespace Assimp {
class MaterialHelper;
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Importer class for the 3DS ASE ASCII format. /** Importer class for the 3DS ASE ASCII format.
@ -125,7 +125,7 @@ private:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Convert a material to a MaterialHelper object /** Convert a material to a aiMaterial object
* \param mat Input material * \param mat Input material
*/ */
void ConvertMaterial(ASE::Material& mat); void ConvertMaterial(ASE::Material& mat);

View File

@ -76,8 +76,8 @@ struct Material : public D3DS::Material
//! Contains all sub materials of this material //! Contains all sub materials of this material
std::vector<Material> avSubMaterials; std::vector<Material> avSubMaterials;
//! MaterialHelper object //! aiMaterial object
MaterialHelper* pcInstance; aiMaterial* pcInstance;
//! Can we remove this material? //! Can we remove this material?
bool bNeed; bool bNeed;

View File

@ -141,7 +141,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Internal utility headers // Internal utility headers
#include "BaseImporter.h" #include "BaseImporter.h"
#include "MaterialSystem.h"
#include "StringComparison.h" #include "StringComparison.h"
#include "StreamReader.h" #include "StreamReader.h"
#include "qnan.h" #include "qnan.h"

View File

@ -254,7 +254,7 @@ void B3DImporter::ReadBRUS(){
/*int blend=**/ReadInt(); /*int blend=**/ReadInt();
int fx=ReadInt(); int fx=ReadInt();
MaterialHelper *mat=new MaterialHelper; aiMaterial *mat=new aiMaterial;
_materials.push_back( mat ); _materials.push_back( mat );
// Name // Name
@ -641,7 +641,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
//material //material
if( !_materials.size() ){ if( !_materials.size() ){
_materials.push_back( new MaterialHelper ); _materials.push_back( new aiMaterial );
} }
scene->mNumMaterials=_materials.size(); scene->mNumMaterials=_materials.size();
scene->mMaterials=to_array( _materials ); scene->mMaterials=to_array( _materials );

View File

@ -106,7 +106,7 @@ private:
* imports the given file. ReadFile is not overridable, it just calls * imports the given file. ReadFile is not overridable, it just calls
* InternReadFile() and catches any ImportErrorException that might occur. * InternReadFile() and catches any ImportErrorException that might occur.
*/ */
class ASSIMP_API BaseImporter class BaseImporter
{ {
friend class Importer; friend class Importer;

View File

@ -60,7 +60,7 @@ class Importer;
* to provide additional information to other steps. This is primarily * to provide additional information to other steps. This is primarily
* intended for cross-step optimizations. * intended for cross-step optimizations.
*/ */
class ASSIMP_API SharedPostProcessInfo class SharedPostProcessInfo
{ {
public: public:
@ -211,7 +211,7 @@ private:
* should be executed. If the function returns true, the class' Execute() * should be executed. If the function returns true, the class' Execute()
* function is called subsequently. * function is called subsequently.
*/ */
class ASSIMP_API BaseProcess class ASSIMP_API_WINONLY BaseProcess
{ {
friend class Importer; friend class Importer;

View File

@ -398,7 +398,7 @@ void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in,const FileD
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderImporter::ResolveImage(MaterialHelper* out, const Material* mat, const MTex* tex, const Image* img, ConversionData& conv_data) void BlenderImporter::ResolveImage(aiMaterial* out, const Material* mat, const MTex* tex, const Image* img, ConversionData& conv_data)
{ {
(void)mat; (void)tex; (void)conv_data; (void)mat; (void)tex; (void)conv_data;
aiString name; aiString name;
@ -443,7 +443,7 @@ void BlenderImporter::ResolveImage(MaterialHelper* out, const Material* mat, con
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderImporter::AddSentinelTexture(MaterialHelper* out, const Material* mat, const MTex* tex, ConversionData& conv_data) void BlenderImporter::AddSentinelTexture(aiMaterial* out, const Material* mat, const MTex* tex, ConversionData& conv_data)
{ {
(void)mat; (void)tex; (void)conv_data; (void)mat; (void)tex; (void)conv_data;
@ -457,7 +457,7 @@ void BlenderImporter::AddSentinelTexture(MaterialHelper* out, const Material* ma
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderImporter::ResolveTexture(MaterialHelper* out, const Material* mat, const MTex* tex, ConversionData& conv_data) void BlenderImporter::ResolveTexture(aiMaterial* out, const Material* mat, const MTex* tex, ConversionData& conv_data)
{ {
const Tex* rtex = tex->tex.get(); const Tex* rtex = tex->tex.get();
if(!rtex || !rtex->type) { if(!rtex || !rtex->type) {
@ -545,7 +545,7 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
conv_data.next_texture[i] = 0 ; conv_data.next_texture[i] = 0 ;
} }
MaterialHelper* mout = new MaterialHelper(); aiMaterial* mout = new aiMaterial();
conv_data.materials->push_back(mout); conv_data.materials->push_back(mout);
// set material name // set material name

View File

@ -203,7 +203,7 @@ private:
// -------------------- // --------------------
void ResolveTexture( void ResolveTexture(
MaterialHelper* out, aiMaterial* out,
const Blender::Material* mat, const Blender::Material* mat,
const Blender::MTex* tex, const Blender::MTex* tex,
Blender::ConversionData& conv_data Blender::ConversionData& conv_data
@ -211,7 +211,7 @@ private:
// -------------------- // --------------------
void ResolveImage( void ResolveImage(
MaterialHelper* out, aiMaterial* out,
const Blender::Material* mat, const Blender::Material* mat,
const Blender::MTex* tex, const Blender::MTex* tex,
const Blender::Image* img, const Blender::Image* img,
@ -219,7 +219,7 @@ private:
); );
void AddSentinelTexture( void AddSentinelTexture(
MaterialHelper* out, aiMaterial* out,
const Blender::Material* mat, const Blender::Material* mat,
const Blender::MTex* tex, const Blender::MTex* tex,
Blender::ConversionData& conv_data Blender::ConversionData& conv_data

View File

@ -207,7 +207,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertTexture(boost::shared_ptr< Texture > tex, MaterialHelper* out, aiTextureType type) void ConvertTexture(boost::shared_ptr< Texture > tex, aiMaterial* out, aiTextureType type)
{ {
const aiString path( tex->path ); const aiString path( tex->path );
out->AddProperty(&path,AI_MATKEY_TEXTURE(type,0)); out->AddProperty(&path,AI_MATKEY_TEXTURE(type,0));
@ -286,7 +286,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
defmat.reset(min=new Material()); defmat.reset(min=new Material());
} }
MaterialHelper* mat = new MaterialHelper(); aiMaterial* mat = new aiMaterial();
fill->mMaterials[fill->mNumMaterials++] = mat; fill->mMaterials[fill->mNumMaterials++] = mat;
const aiString s(format("#mat_")<<fill->mNumMeshes<<"_"<<min->matnum); const aiString s(format("#mat_")<<fill->mNumMeshes<<"_"<<min->matnum);

View File

@ -57,7 +57,7 @@ namespace Assimp
* because the joining of vertices also considers tangents and bitangents for * because the joining of vertices also considers tangents and bitangents for
* uniqueness. * uniqueness.
*/ */
class ASSIMP_API CalcTangentsProcess : public BaseProcess class ASSIMP_API_WINONLY CalcTangentsProcess : public BaseProcess
{ {
public: public:

View File

@ -55,7 +55,7 @@ namespace Assimp
/// Helper class to export a given scene to a Collada file. Just for my personal /// Helper class to export a given scene to a Collada file. Just for my personal
/// comfort when implementing it. /// comfort when implementing it.
class ASSIMP_API ColladaExporter class ColladaExporter
{ {
public: public:
/// Constructor for a specific scene to export /// Constructor for a specific scene to export

View File

@ -1117,7 +1117,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Add a texture to a material structure // Add a texture to a material structure
void ColladaLoader::AddTexture ( Assimp::MaterialHelper& mat, const ColladaParser& pParser, void ColladaLoader::AddTexture ( aiMaterial& mat, const ColladaParser& pParser,
const Collada::Effect& effect, const Collada::Effect& effect,
const Collada::Sampler& sampler, const Collada::Sampler& sampler,
aiTextureType type, unsigned int idx) aiTextureType type, unsigned int idx)
@ -1185,7 +1185,7 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
for (std::vector<std::pair<Collada::Effect*, aiMaterial*> >::iterator it = newMats.begin(), for (std::vector<std::pair<Collada::Effect*, aiMaterial*> >::iterator it = newMats.begin(),
end = newMats.end(); it != end; ++it) end = newMats.end(); it != end; ++it)
{ {
MaterialHelper& mat = (MaterialHelper&)*it->second; aiMaterial& mat = (aiMaterial&)*it->second;
Collada::Effect& effect = *it->first; Collada::Effect& effect = *it->first;
// resolve shading mode // resolve shading mode
@ -1286,7 +1286,7 @@ void ColladaLoader::BuildMaterials( const ColladaParser& pParser, aiScene* /*pSc
const Collada::Effect& effect = effIt->second; const Collada::Effect& effect = effIt->second;
// create material // create material
Assimp::MaterialHelper* mat = new Assimp::MaterialHelper; aiMaterial* mat = new aiMaterial;
aiString name( matIt->first); aiString name( matIt->first);
mat->AddProperty(&name,AI_MATKEY_NAME); mat->AddProperty(&name,AI_MATKEY_NAME);
@ -1300,7 +1300,7 @@ void ColladaLoader::BuildMaterials( const ColladaParser& pParser, aiScene* /*pSc
#if 0 #if 0
if( newMats.size() == 0) if( newMats.size() == 0)
{ {
Assimp::MaterialHelper* mat = new Assimp::MaterialHelper; aiMaterial* mat = new aiMaterial;
aiString name( AI_DEFAULT_MATERIAL_NAME ); aiString name( AI_DEFAULT_MATERIAL_NAME );
mat->AddProperty( &name, AI_MATKEY_NAME); mat->AddProperty( &name, AI_MATKEY_NAME);

View File

@ -163,7 +163,7 @@ protected:
const Collada::SemanticMappingTable& table); const Collada::SemanticMappingTable& table);
/** Add a texture and all of its sampling properties to a material*/ /** Add a texture and all of its sampling properties to a material*/
void AddTexture ( Assimp::MaterialHelper& mat, const ColladaParser& pParser, void AddTexture ( aiMaterial& mat, const ColladaParser& pParser,
const Collada::Effect& effect, const Collada::Effect& effect,
const Collada::Sampler& sampler, const Collada::Sampler& sampler,
aiTextureType type, unsigned int idx = 0); aiTextureType type, unsigned int idx = 0);

View File

@ -495,7 +495,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene)
// Update the material property list // Update the material property list
mapping = aiTextureMapping_UV; mapping = aiTextureMapping_UV;
((MaterialHelper*)mat)->AddProperty(&idx,1,AI_MATKEY_UVWSRC(prop->mSemantic,prop->mIndex)); ((aiMaterial*)mat)->AddProperty(&idx,1,AI_MATKEY_UVWSRC(prop->mSemantic,prop->mIndex));
} }
} }
} }

View File

@ -54,7 +54,7 @@ namespace Assimp
/** ComputeUVMappingProcess - converts special mappings, such as spherical, /** ComputeUVMappingProcess - converts special mappings, such as spherical,
* cylindrical or boxed to proper UV coordinates for rendering. * cylindrical or boxed to proper UV coordinates for rendering.
*/ */
class ASSIMP_API ComputeUVMappingProcess : public BaseProcess class ComputeUVMappingProcess : public BaseProcess
{ {
public: public:
ComputeUVMappingProcess(); ComputeUVMappingProcess();

View File

@ -166,7 +166,7 @@ void MakeLeftHandedProcess::ProcessMesh( aiMesh* pMesh)
// Converts a single material to left handed coordinates. // Converts a single material to left handed coordinates.
void MakeLeftHandedProcess::ProcessMaterial( aiMaterial* _mat) void MakeLeftHandedProcess::ProcessMaterial( aiMaterial* _mat)
{ {
MaterialHelper* mat = (MaterialHelper*)_mat; aiMaterial* mat = (aiMaterial*)_mat;
for (unsigned int a = 0; a < mat->mNumProperties;++a) { for (unsigned int a = 0; a < mat->mNumProperties;++a) {
aiMaterialProperty* prop = mat->mProperties[a]; aiMaterialProperty* prop = mat->mProperties[a];
@ -241,7 +241,7 @@ void FlipUVsProcess::Execute( aiScene* pScene)
// Converts a single material // Converts a single material
void FlipUVsProcess::ProcessMaterial (aiMaterial* _mat) void FlipUVsProcess::ProcessMaterial (aiMaterial* _mat)
{ {
MaterialHelper* mat = (MaterialHelper*)_mat; aiMaterial* mat = (aiMaterial*)_mat;
for (unsigned int a = 0; a < mat->mNumProperties;++a) { for (unsigned int a = 0; a < mat->mNumProperties;++a) {
aiMaterialProperty* prop = mat->mProperties[a]; aiMaterialProperty* prop = mat->mProperties[a];

View File

@ -67,7 +67,7 @@ namespace Assimp {
* *
* @note RH-LH and LH-RH is the same, so this class can be used for both * @note RH-LH and LH-RH is the same, so this class can be used for both
*/ */
class ASSIMP_API MakeLeftHandedProcess : public BaseProcess class MakeLeftHandedProcess : public BaseProcess
{ {
@ -115,7 +115,7 @@ protected:
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** Postprocessing step to flip the face order of the imported data /** Postprocessing step to flip the face order of the imported data
*/ */
class ASSIMP_API FlipWindingOrderProcess : public BaseProcess class FlipWindingOrderProcess : public BaseProcess
{ {
friend class Importer; friend class Importer;
@ -139,7 +139,7 @@ protected:
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** Postprocessing step to flip the UV coordinate system of the import data /** Postprocessing step to flip the UV coordinate system of the import data
*/ */
class ASSIMP_API FlipUVsProcess : public BaseProcess class FlipUVsProcess : public BaseProcess
{ {
friend class Importer; friend class Importer;

View File

@ -387,7 +387,7 @@ void DXFImporter::GenerateMaterials(aiScene* pScene, DXF::FileData& /*output*/)
// the default vertex color is GREY, so we are // the default vertex color is GREY, so we are
// already at Assimp's usual default color. // already at Assimp's usual default color.
// generate a default material // generate a default material
MaterialHelper* pcMat = new MaterialHelper(); aiMaterial* pcMat = new aiMaterial();
aiString s; aiString s;
s.Set(AI_DEFAULT_MATERIAL_NAME); s.Set(AI_DEFAULT_MATERIAL_NAME);
pcMat->AddProperty(&s, AI_MATKEY_NAME); pcMat->AddProperty(&s, AI_MATKEY_NAME);

View File

@ -64,7 +64,7 @@ namespace Assimp
* the bone are split from the mesh. The split off (new) mesh is boneless. At any * the bone are split from the mesh. The split off (new) mesh is boneless. At any
* point in time, bones without affect upon a given mesh are to be removed. * point in time, bones without affect upon a given mesh are to be removed.
*/ */
class ASSIMP_API DeboneProcess : public BaseProcess class DeboneProcess : public BaseProcess
{ {
public: public:

View File

@ -49,7 +49,7 @@ namespace Assimp {
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
/** @brief Internal default implementation of the #ProgressHandler interface. */ /** @brief Internal default implementation of the #ProgressHandler interface. */
class ASSIMP_API DefaultProgressHandler class DefaultProgressHandler
: public ProgressHandler { : public ProgressHandler {

View File

@ -52,7 +52,7 @@ using std::runtime_error;
/** FOR IMPORTER PLUGINS ONLY: Simple exception class to be thrown if an /** FOR IMPORTER PLUGINS ONLY: Simple exception class to be thrown if an
* unrecoverable error occurs while importing. Loading APIs return * unrecoverable error occurs while importing. Loading APIs return
* NULL instead of a valid aiScene then. */ * NULL instead of a valid aiScene then. */
class ASSIMP_API DeadlyImportError class DeadlyImportError
: public runtime_error : public runtime_error
{ {
public: public:

View File

@ -53,7 +53,7 @@ namespace Assimp {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** FindDegeneratesProcess: Searches a mesh for degenerated triangles. /** FindDegeneratesProcess: Searches a mesh for degenerated triangles.
*/ */
class ASSIMP_API FindDegeneratesProcess : public BaseProcess class FindDegeneratesProcess : public BaseProcess
{ {
public: public:

View File

@ -105,7 +105,7 @@ inline bool CompareArrays(const aiColor4D* first, const aiColor4D* second,
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** @brief A post-processing steps to search for instanced meshes /** @brief A post-processing steps to search for instanced meshes
*/ */
class ASSIMP_API FindInstancesProcess : public BaseProcess class FindInstancesProcess : public BaseProcess
{ {
public: public:

View File

@ -56,7 +56,7 @@ namespace Assimp {
* *
* Originally this was a workaround for some models written by Blender * Originally this was a workaround for some models written by Blender
* which have zero normal vectors. */ * which have zero normal vectors. */
class ASSIMP_API FindInvalidDataProcess class FindInvalidDataProcess
: public BaseProcess : public BaseProcess
{ {
public: public:

View File

@ -55,7 +55,7 @@ namespace Assimp
* vectors of an object are facing inwards. In this case they will be * vectors of an object are facing inwards. In this case they will be
* flipped. * flipped.
*/ */
class ASSIMP_API FixInfacingNormalsProcess : public BaseProcess class FixInfacingNormalsProcess : public BaseProcess
{ {
public: public:

View File

@ -51,7 +51,7 @@ namespace Assimp
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** The GenFaceNormalsProcess computes face normals for all faces of all meshes /** The GenFaceNormalsProcess computes face normals for all faces of all meshes
*/ */
class ASSIMP_API GenFaceNormalsProcess : public BaseProcess class ASSIMP_API_WINONLY GenFaceNormalsProcess : public BaseProcess
{ {
public: public:

View File

@ -53,7 +53,7 @@ namespace Assimp {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** The GenFaceNormalsProcess computes vertex normals for all vertizes /** The GenFaceNormalsProcess computes vertex normals for all vertizes
*/ */
class ASSIMP_API GenVertexNormalsProcess : public BaseProcess class ASSIMP_API_WINONLY GenVertexNormalsProcess : public BaseProcess
{ {
public: public:

View File

@ -45,7 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_HMP_IMPORTER #ifndef ASSIMP_BUILD_NO_HMP_IMPORTER
// internal headers // internal headers
#include "MaterialSystem.h"
#include "HMPLoader.h" #include "HMPLoader.h"
#include "MD2FileData.h" #include "MD2FileData.h"
@ -339,7 +338,7 @@ void HMPImporter::CreateMaterial(const unsigned char* szCurrent,
{ {
// generate a default material // generate a default material
const int iMode = (int)aiShadingMode_Gouraud; const int iMode = (int)aiShadingMode_Gouraud;
MaterialHelper* pcHelper = new MaterialHelper(); aiMaterial* pcHelper = new aiMaterial();
pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL); pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);
aiColor3D clr; aiColor3D clr;
@ -447,7 +446,7 @@ void HMPImporter::ReadFirstSkin(unsigned int iNumSkins, const unsigned char* szC
uint32_t iHeight = *((uint32_t*)szCursor); szCursor += sizeof(uint32_t); uint32_t iHeight = *((uint32_t*)szCursor); szCursor += sizeof(uint32_t);
// allocate an output material // allocate an output material
MaterialHelper* pcMat = new MaterialHelper(); aiMaterial* pcMat = new aiMaterial();
// read the skin, this works exactly as for MDL7 // read the skin, this works exactly as for MDL7
ParseSkinLump_3DGS_MDL7(szCursor,&szCursor, ParseSkinLump_3DGS_MDL7(szCursor,&szCursor,

View File

@ -67,7 +67,7 @@ int ConvertShadingMode(const std::string& name)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void FillMaterial(MaterialHelper* mat,const IFC::IfcSurfaceStyle* surf,ConversionData& conv) void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,ConversionData& conv)
{ {
aiString name; aiString name;
name.Set((surf->Name? surf->Name.Get() : "IfcSurfaceStyle_Unnamed")); name.Set((surf->Name? surf->Name.Get() : "IfcSurfaceStyle_Unnamed"));
@ -136,7 +136,7 @@ unsigned int ProcessMaterials(const IFC::IfcRepresentationItem& item, Conversion
{ {
if (conv.materials.empty()) { if (conv.materials.empty()) {
aiString name; aiString name;
std::auto_ptr<MaterialHelper> mat(new MaterialHelper()); std::auto_ptr<aiMaterial> mat(new aiMaterial());
name.Set("<IFCDefault>"); name.Set("<IFCDefault>");
mat->AddProperty(&name,AI_MATKEY_NAME); mat->AddProperty(&name,AI_MATKEY_NAME);
@ -159,7 +159,7 @@ unsigned int ProcessMaterials(const IFC::IfcRepresentationItem& item, Conversion
IFCImporter::LogWarn("ignoring surface side marker on IFC::IfcSurfaceStyle: " + side); IFCImporter::LogWarn("ignoring surface side marker on IFC::IfcSurfaceStyle: " + side);
} }
std::auto_ptr<MaterialHelper> mat(new MaterialHelper()); std::auto_ptr<aiMaterial> mat(new aiMaterial());
FillMaterial(mat.get(),surf,conv); FillMaterial(mat.get(),surf,conv);

View File

@ -170,7 +170,7 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
{ {
// Update the material of the skybox - replace the name and disable shading for skyboxes. // Update the material of the skybox - replace the name and disable shading for skyboxes.
for (unsigned int i = 0; i < 6;++i) { for (unsigned int i = 0; i < 6;++i) {
MaterialHelper* out = ( MaterialHelper* ) (*(materials.end()-(6-i))); aiMaterial* out = ( aiMaterial* ) (*(materials.end()-(6-i)));
aiString s; aiString s;
s.length = ::sprintf( s.data, "SkyboxSide_%i",i ); s.length = ::sprintf( s.data, "SkyboxSide_%i",i );
@ -246,7 +246,7 @@ void IRRImporter::CopyMaterial(std::vector<aiMaterial*>& materials,
if (UINT_MAX == defMatIdx) if (UINT_MAX == defMatIdx)
{ {
defMatIdx = (unsigned int)materials.size(); defMatIdx = (unsigned int)materials.size();
MaterialHelper* mat = new MaterialHelper(); aiMaterial* mat = new aiMaterial();
aiString s; aiString s;
s.Set(AI_DEFAULT_MATERIAL_NAME); s.Set(AI_DEFAULT_MATERIAL_NAME);
@ -564,7 +564,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// This function is maybe more generic than we'd need it here // This function is maybe more generic than we'd need it here
void SetupMapping (MaterialHelper* mat, aiTextureMapping mode, const aiVector3D& axis = aiVector3D(0.f,0.f,-1.f)) void SetupMapping (aiMaterial* mat, aiTextureMapping mode, const aiVector3D& axis = aiVector3D(0.f,0.f,-1.f))
{ {
// Check whether there are texture properties defined - setup // Check whether there are texture properties defined - setup
// the desired texture mapping mode for all of them and ignore // the desired texture mapping mode for all of them and ignore
@ -687,7 +687,7 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
// often the case so we can simply extract it to a shared oacity // often the case so we can simply extract it to a shared oacity
// value. // value.
std::pair<aiMaterial*, unsigned int>& src = root->materials[mesh->mMaterialIndex]; std::pair<aiMaterial*, unsigned int>& src = root->materials[mesh->mMaterialIndex];
MaterialHelper* mat = (MaterialHelper*)src.first; aiMaterial* mat = (aiMaterial*)src.first;
if (mesh->HasVertexColors(0) && src.second & AI_IRRMESH_MAT_trans_vertex_alpha) if (mesh->HasVertexColors(0) && src.second & AI_IRRMESH_MAT_trans_vertex_alpha)
{ {
@ -757,7 +757,7 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
// Now adjust this output material - if there is a first texture // Now adjust this output material - if there is a first texture
// set, setup spherical UV mapping around the Y axis. // set, setup spherical UV mapping around the Y axis.
SetupMapping ( (MaterialHelper*) materials.back(), aiTextureMapping_SPHERE); SetupMapping ( (aiMaterial*) materials.back(), aiTextureMapping_SPHERE);
} }
break; break;
@ -775,7 +775,7 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
// Now adjust this output material - if there is a first texture // Now adjust this output material - if there is a first texture
// set, setup cubic UV mapping // set, setup cubic UV mapping
SetupMapping ( (MaterialHelper*) materials.back(), aiTextureMapping_BOX ); SetupMapping ( (aiMaterial*) materials.back(), aiTextureMapping_BOX );
} }
break; break;

View File

@ -199,7 +199,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
// map (normal_..., parallax_...) // map (normal_..., parallax_...)
// ********************************************************* // *********************************************************
int idx = 1; int idx = 1;
MaterialHelper* mat = ( MaterialHelper* ) curMat; aiMaterial* mat = ( aiMaterial* ) curMat;
if (curMatFlags & AI_IRRMESH_MAT_lightmap){ if (curMatFlags & AI_IRRMESH_MAT_lightmap){
mat->AddProperty(&idx,1,AI_MATKEY_UVWSRC_LIGHTMAP(0)); mat->AddProperty(&idx,1,AI_MATKEY_UVWSRC_LIGHTMAP(0));
@ -440,7 +440,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile,
if (curMatFlags & AI_IRRMESH_MAT_trans_vertex_alpha && !useColors) { if (curMatFlags & AI_IRRMESH_MAT_trans_vertex_alpha && !useColors) {
// Take the opacity value of the current material // Take the opacity value of the current material
// from the common vertex color alpha // from the common vertex color alpha
MaterialHelper* mat = (MaterialHelper*)curMat; aiMaterial* mat = (aiMaterial*)curMat;
mat->AddProperty(&curColors[0].a,1,AI_MATKEY_OPACITY); mat->AddProperty(&curColors[0].a,1,AI_MATKEY_OPACITY);
} }
}} }}

View File

@ -204,7 +204,7 @@ int ConvertMappingMode(const std::string& mode)
// Parse a material from the XML file // Parse a material from the XML file
aiMaterial* IrrlichtBase::ParseMaterial(unsigned int& matFlags) aiMaterial* IrrlichtBase::ParseMaterial(unsigned int& matFlags)
{ {
MaterialHelper* mat = new MaterialHelper(); aiMaterial* mat = new aiMaterial();
aiColor4D clr; aiColor4D clr;
aiString s; aiString s;

View File

@ -56,7 +56,7 @@ namespace Assimp {
* std::vector and std::map in the public headers. Furthermore we are dropping * std::vector and std::map in the public headers. Furthermore we are dropping
* any STL interface problems caused by mismatching STL settings. All * any STL interface problems caused by mismatching STL settings. All
* size calculation are now done by us, not the app heap. */ * size calculation are now done by us, not the app heap. */
class ASSIMP_API ImporterPimpl class ImporterPimpl
{ {
public: public:
@ -120,7 +120,7 @@ struct BatchData;
* could, this has not yet been implemented at the moment). * could, this has not yet been implemented at the moment).
* *
* @note The class may not be used by more than one thread*/ * @note The class may not be used by more than one thread*/
class ASSIMP_API BatchLoader class BatchLoader
{ {
// friend of Importer // friend of Importer

View File

@ -58,7 +58,7 @@ namespace Assimp
* *
* @note This step expects triagulated input data. * @note This step expects triagulated input data.
*/ */
class ASSIMP_API ImproveCacheLocalityProcess : public BaseProcess class ImproveCacheLocalityProcess : public BaseProcess
{ {
public: public:

View File

@ -46,8 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BaseProcess.h" #include "BaseProcess.h"
#include "../include/aiTypes.h" #include "../include/aiTypes.h"
struct aiMesh;
namespace Assimp namespace Assimp
{ {
@ -61,7 +59,7 @@ class JoinVerticesTest;
* erases all but one of the copies. This usually reduces the number of vertices * erases all but one of the copies. This usually reduces the number of vertices
* in a mesh by a serious amount and is the standard form to render a mesh. * in a mesh by a serious amount and is the standard form to render a mesh.
*/ */
class ASSIMP_API JoinVerticesProcess : public BaseProcess class ASSIMP_API_WINONLY JoinVerticesProcess : public BaseProcess
{ {
public: public:

View File

@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "LWOLoader.h" #include "LWOLoader.h"
#include "MaterialSystem.h"
#include "StringComparison.h" #include "StringComparison.h"
#include "SGSpatialSort.h" #include "SGSpatialSort.h"
#include "ByteSwap.h" #include "ByteSwap.h"
@ -404,7 +403,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
// The RemoveRedundantMaterials step will clean this up later // The RemoveRedundantMaterials step will clean this up later
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = (unsigned int)mSurfaces->size()]; pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = (unsigned int)mSurfaces->size()];
for (unsigned int mat = 0; mat < pScene->mNumMaterials;++mat) { for (unsigned int mat = 0; mat < pScene->mNumMaterials;++mat) {
MaterialHelper* pcMat = new MaterialHelper(); aiMaterial* pcMat = new aiMaterial();
pScene->mMaterials[mat] = pcMat; pScene->mMaterials[mat] = pcMat;
ConvertMaterial((*mSurfaces)[mat],pcMat); ConvertMaterial((*mSurfaces)[mat],pcMat);
} }

View File

@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "LWOFileData.h" #include "LWOFileData.h"
#include "BaseImporter.h" #include "BaseImporter.h"
#include "MaterialSystem.h"
struct aiTexture; struct aiTexture;
struct aiNode; struct aiNode;
@ -262,7 +261,7 @@ private:
* @param in Input texture list * @param in Input texture list
* @param type Type identifier of the texture list * @param type Type identifier of the texture list
*/ */
bool HandleTextures(MaterialHelper* pcMat, const TextureList& in, bool HandleTextures(aiMaterial* pcMat, const TextureList& in,
aiTextureType type); aiTextureType type);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -273,7 +272,7 @@ private:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Convert a LWO surface description to an ASSIMP material /** Convert a LWO surface description to an ASSIMP material
*/ */
void ConvertMaterial(const LWO::Surface& surf,MaterialHelper* pcMat); void ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat);
// ------------------------------------------------------------------- // -------------------------------------------------------------------

View File

@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "LWOLoader.h" #include "LWOLoader.h"
#include "MaterialSystem.h"
#include "ByteSwap.h" #include "ByteSwap.h"
using namespace Assimp; using namespace Assimp;
@ -82,7 +81,7 @@ inline aiTextureMapMode GetMapMode(LWO::Texture::Wrap in)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool LWOImporter::HandleTextures(MaterialHelper* pcMat, const TextureList& in, aiTextureType type) bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTextureType type)
{ {
ai_assert(NULL != pcMat); ai_assert(NULL != pcMat);
@ -265,7 +264,7 @@ bool LWOImporter::HandleTextures(MaterialHelper* pcMat, const TextureList& in, a
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void LWOImporter::ConvertMaterial(const LWO::Surface& surf,MaterialHelper* pcMat) void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat)
{ {
// copy the name of the surface // copy the name of the surface
aiString st; aiString st;

View File

@ -69,7 +69,7 @@ namespace Assimp
* The other weights on this bone are then renormalized to assure the sum weight * The other weights on this bone are then renormalized to assure the sum weight
* to be 1. * to be 1.
*/ */
class ASSIMP_API LimitBoneWeightsProcess : public BaseProcess class LimitBoneWeightsProcess : public BaseProcess
{ {
public: public:

View File

@ -44,7 +44,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file Implementation of the MD2 importer class */ /** @file Implementation of the MD2 importer class */
#include "MD2Loader.h" #include "MD2Loader.h"
#include "MaterialSystem.h"
#include "ByteSwap.h" #include "ByteSwap.h"
#include "MD2NormalTable.h" // shouldn't be included by other units #include "MD2NormalTable.h" // shouldn't be included by other units
@ -221,7 +220,7 @@ void MD2Importer::InternReadFile( const std::string& pFile,
pScene->mRootNode->mMeshes = new unsigned int[1]; pScene->mRootNode->mMeshes = new unsigned int[1];
pScene->mRootNode->mMeshes[0] = 0; pScene->mRootNode->mMeshes[0] = 0;
pScene->mMaterials = new aiMaterial*[1]; pScene->mMaterials = new aiMaterial*[1];
pScene->mMaterials[0] = new MaterialHelper(); pScene->mMaterials[0] = new aiMaterial();
pScene->mNumMeshes = 1; pScene->mNumMeshes = 1;
pScene->mMeshes = new aiMesh*[1]; pScene->mMeshes = new aiMesh*[1];
@ -278,7 +277,7 @@ void MD2Importer::InternReadFile( const std::string& pFile,
// Not sure whether there are MD2 files without texture coordinates // Not sure whether there are MD2 files without texture coordinates
// NOTE: texture coordinates can be there without a texture, // NOTE: texture coordinates can be there without a texture,
// but a texture can't be there without a valid UV channel // but a texture can't be there without a valid UV channel
MaterialHelper* pcHelper = (MaterialHelper*)pScene->mMaterials[0]; aiMaterial* pcHelper = (aiMaterial*)pScene->mMaterials[0];
const int iMode = (int)aiShadingMode_Gouraud; const int iMode = (int)aiShadingMode_Gouraud;
pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL); pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);

View File

@ -51,7 +51,7 @@ struct aiNode;
#include "MD2FileData.h" #include "MD2FileData.h"
namespace Assimp { namespace Assimp {
class MaterialHelper;
using namespace MD2; using namespace MD2;

View File

@ -250,7 +250,7 @@ bool Q3Shader::LoadSkin(SkinData& fill, const std::string& pFile,IOSystem* io)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Convert Q3Shader to material // Convert Q3Shader to material
void Q3Shader::ConvertShaderToMaterial(MaterialHelper* out, const ShaderDataBlock& shader) void Q3Shader::ConvertShaderToMaterial(aiMaterial* out, const ShaderDataBlock& shader)
{ {
ai_assert(NULL != out); ai_assert(NULL != out);
@ -877,7 +877,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
else DefaultLogger::get()->warn("Unable to find shader record for " +without_ext ); else DefaultLogger::get()->warn("Unable to find shader record for " +without_ext );
} }
MaterialHelper* pcHelper = new MaterialHelper(); aiMaterial* pcHelper = new aiMaterial();
const int iMode = (int)aiShadingMode_Gouraud; const int iMode = (int)aiShadingMode_Gouraud;
pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL); pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);

View File

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "MD3FileData.h" #include "MD3FileData.h"
namespace Assimp { namespace Assimp {
class MaterialHelper;
using namespace MD3; using namespace MD3;
namespace Q3Shader { namespace Q3Shader {
@ -191,7 +191,7 @@ bool LoadShader(ShaderData& fill, const std::string& file,IOSystem* io);
* @param[out] out Material structure to be filled. * @param[out] out Material structure to be filled.
* @param[in] shader Input shader * @param[in] shader Input shader
*/ */
void ConvertShaderToMaterial(MaterialHelper* out, const ShaderDataBlock& shader); void ConvertShaderToMaterial(aiMaterial* out, const ShaderDataBlock& shader);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** @brief Load a skin file /** @brief Load a skin file

View File

@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_MD5_IMPORTER #ifndef ASSIMP_BUILD_NO_MD5_IMPORTER
// internal headers // internal headers
#include "MaterialSystem.h"
#include "RemoveComments.h" #include "RemoveComments.h"
#include "MD5Loader.h" #include "MD5Loader.h"
#include "StringComparison.h" #include "StringComparison.h"
@ -507,7 +506,7 @@ void MD5Importer::LoadMD5MeshFile ()
} }
// generate a material for the mesh // generate a material for the mesh
MaterialHelper* mat = new MaterialHelper(); aiMaterial* mat = new aiMaterial();
pScene->mMaterials[n] = mat; pScene->mMaterials[n] = mat;
// insert the typical doom3 textures: // insert the typical doom3 textures:

View File

@ -439,7 +439,7 @@ void MDCImporter::InternReadFile(
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials]; pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials];
for (unsigned int i = 0; i < pScene->mNumMaterials;++i) for (unsigned int i = 0; i < pScene->mNumMaterials;++i)
{ {
MaterialHelper* pcMat = new MaterialHelper(); aiMaterial* pcMat = new aiMaterial();
pScene->mMaterials[i] = pcMat; pScene->mMaterials[i] = pcMat;
const std::string& name = aszShaders[i]; const std::string& name = aszShaders[i];

View File

@ -763,7 +763,7 @@ struct IntMaterial_MDL7
} }
//! Material instance //! Material instance
MaterialHelper* pcMat; aiMaterial* pcMat;
//! Old material indices //! Old material indices
unsigned int iOldMatIndices[2]; unsigned int iOldMatIndices[2];
@ -909,7 +909,7 @@ struct IntSharedData_MDL7
std::vector<bool> abNeedMaterials; std::vector<bool> abNeedMaterials;
//! List of all materials //! List of all materials
std::vector<MaterialHelper*> pcMats; std::vector<aiMaterial*> pcMats;
//! List of all bones //! List of all bones
IntBone_MDL7** apcOutBones; IntBone_MDL7** apcOutBones;

View File

@ -494,12 +494,12 @@ void MDLImporter::SetupMaterialProperties_3DGS_MDL5_Quake1( )
// allocate ONE material // allocate ONE material
pScene->mMaterials = new aiMaterial*[1]; pScene->mMaterials = new aiMaterial*[1];
pScene->mMaterials[0] = new MaterialHelper(); pScene->mMaterials[0] = new aiMaterial();
pScene->mNumMaterials = 1; pScene->mNumMaterials = 1;
// setup the material's properties // setup the material's properties
const int iMode = (int)aiShadingMode_Gouraud; const int iMode = (int)aiShadingMode_Gouraud;
MaterialHelper* const pcHelper = (MaterialHelper*)pScene->mMaterials[0]; aiMaterial* const pcHelper = (aiMaterial*)pScene->mMaterials[0];
pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL); pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);
aiColor4D clr; aiColor4D clr;
@ -1268,7 +1268,7 @@ void MDLImporter::SortByMaterials_3DGS_MDL7(
if (!bFound) { if (!bFound) {
// build a new material ... // build a new material ...
MDL::IntMaterial_MDL7 sHelper; MDL::IntMaterial_MDL7 sHelper;
sHelper.pcMat = new MaterialHelper(); sHelper.pcMat = new aiMaterial();
sHelper.iOldMatIndices[0] = iMatIndex; sHelper.iOldMatIndices[0] = iMatIndex;
sHelper.iOldMatIndices[1] = iMatIndex2; sHelper.iOldMatIndices[1] = iMatIndex2;
JoinSkins_3DGS_MDL7(splitGroupData.shared.pcMats[iMatIndex], JoinSkins_3DGS_MDL7(splitGroupData.shared.pcMats[iMatIndex],
@ -1394,8 +1394,8 @@ void MDLImporter::InternReadFile_3DGS_MDL7( )
// if we have absolutely no skin loaded we need to generate a default material // if we have absolutely no skin loaded we need to generate a default material
if (sharedData.pcMats.empty()) { if (sharedData.pcMats.empty()) {
const int iMode = (int)aiShadingMode_Gouraud; const int iMode = (int)aiShadingMode_Gouraud;
sharedData.pcMats.push_back(new MaterialHelper()); sharedData.pcMats.push_back(new aiMaterial());
MaterialHelper* pcHelper = (MaterialHelper*)sharedData.pcMats[0]; aiMaterial* pcHelper = (aiMaterial*)sharedData.pcMats[0];
pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL); pcHelper->AddProperty<int>(&iMode, 1, AI_MATKEY_SHADING_MODEL);
aiColor3D clr; aiColor3D clr;
@ -1781,7 +1781,7 @@ void MDLImporter::GenerateOutputMeshes_3DGS_MDL7(
const MDL::Header_MDL7* const pcHeader = (const MDL::Header_MDL7*)this->mBuffer; const MDL::Header_MDL7* const pcHeader = (const MDL::Header_MDL7*)this->mBuffer;
const unsigned int iNumOutBones = pcHeader->bones_num; const unsigned int iNumOutBones = pcHeader->bones_num;
for (std::vector<MaterialHelper*>::size_type i = 0; i < shared.pcMats.size();++i) { for (std::vector<aiMaterial*>::size_type i = 0; i < shared.pcMats.size();++i) {
if (!splitGroupData.aiSplit[i]->empty()) { if (!splitGroupData.aiSplit[i]->empty()) {
// allocate the output mesh // allocate the output mesh
@ -1895,15 +1895,15 @@ void MDLImporter::GenerateOutputMeshes_3DGS_MDL7(
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Join to materials // Join to materials
void MDLImporter::JoinSkins_3DGS_MDL7( void MDLImporter::JoinSkins_3DGS_MDL7(
MaterialHelper* pcMat1, aiMaterial* pcMat1,
MaterialHelper* pcMat2, aiMaterial* pcMat2,
MaterialHelper* pcMatOut) aiMaterial* pcMatOut)
{ {
ai_assert(NULL != pcMat1 && NULL != pcMat2 && NULL != pcMatOut); ai_assert(NULL != pcMat1 && NULL != pcMat2 && NULL != pcMatOut);
// first create a full copy of the first skin property set // first create a full copy of the first skin property set
// and assign it to the output material // and assign it to the output material
MaterialHelper::CopyPropertyList(pcMatOut,pcMat1); aiMaterial::CopyPropertyList(pcMatOut,pcMat1);
int iVal = 0; int iVal = 0;
pcMatOut->AddProperty<int>(&iVal,1,AI_MATKEY_UVWSRC_DIFFUSE(0)); pcMatOut->AddProperty<int>(&iVal,1,AI_MATKEY_UVWSRC_DIFFUSE(0));

View File

@ -53,7 +53,7 @@ struct aiNode;
#include "HalfLifeFileData.h" #include "HalfLifeFileData.h"
namespace Assimp { namespace Assimp {
class MaterialHelper;
using namespace MDL; using namespace MDL;
@ -253,7 +253,7 @@ protected:
void ParseSkinLump_3DGS_MDL7( void ParseSkinLump_3DGS_MDL7(
const unsigned char* szCurrent, const unsigned char* szCurrent,
const unsigned char** szCurrentOut, const unsigned char** szCurrentOut,
std::vector<MaterialHelper*>& pcMats); std::vector<aiMaterial*>& pcMats);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Parse a skin lump in a MDL7/HMP7 file with all of its features /** Parse a skin lump in a MDL7/HMP7 file with all of its features
@ -268,7 +268,7 @@ protected:
void ParseSkinLump_3DGS_MDL7( void ParseSkinLump_3DGS_MDL7(
const unsigned char* szCurrent, const unsigned char* szCurrent,
const unsigned char** szCurrentOut, const unsigned char** szCurrentOut,
MaterialHelper* pcMatOut, aiMaterial* pcMatOut,
unsigned int iType, unsigned int iType,
unsigned int iWidth, unsigned int iWidth,
unsigned int iHeight); unsigned int iHeight);
@ -309,9 +309,9 @@ protected:
* \param pcMat2 Second input material * \param pcMat2 Second input material
* \param pcMatOut Output material instance to be filled. Must be empty * \param pcMatOut Output material instance to be filled. Must be empty
*/ */
void JoinSkins_3DGS_MDL7(MaterialHelper* pcMat1, void JoinSkins_3DGS_MDL7(aiMaterial* pcMat1,
MaterialHelper* pcMat2, aiMaterial* pcMat2,
MaterialHelper* pcMatOut); aiMaterial* pcMatOut);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Add a bone transformation key to an animation /** Add a bone transformation key to an animation

View File

@ -475,7 +475,7 @@ void MDLImporter::CreateTexture_3DGS_MDL5(const unsigned char* szData,
void MDLImporter::ParseSkinLump_3DGS_MDL7( void MDLImporter::ParseSkinLump_3DGS_MDL7(
const unsigned char* szCurrent, const unsigned char* szCurrent,
const unsigned char** szCurrentOut, const unsigned char** szCurrentOut,
MaterialHelper* pcMatOut, aiMaterial* pcMatOut,
unsigned int iType, unsigned int iType,
unsigned int iWidth, unsigned int iWidth,
unsigned int iHeight) unsigned int iHeight)
@ -791,7 +791,7 @@ void MDLImporter::SkipSkinLump_3DGS_MDL7(
void MDLImporter::ParseSkinLump_3DGS_MDL7( void MDLImporter::ParseSkinLump_3DGS_MDL7(
const unsigned char* szCurrent, const unsigned char* szCurrent,
const unsigned char** szCurrentOut, const unsigned char** szCurrentOut,
std::vector<MaterialHelper*>& pcMats) std::vector<aiMaterial*>& pcMats)
{ {
ai_assert(NULL != szCurrent); ai_assert(NULL != szCurrent);
ai_assert(NULL != szCurrentOut); ai_assert(NULL != szCurrentOut);
@ -803,7 +803,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
szCurrent += 12; szCurrent += 12;
// allocate an output material // allocate an output material
MaterialHelper* pcMatOut = new MaterialHelper(); aiMaterial* pcMatOut = new aiMaterial();
pcMats.push_back(pcMatOut); pcMats.push_back(pcMatOut);
// skip length of file name // skip length of file name

View File

@ -414,7 +414,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
pScene->mMaterials = new aiMaterial*[materials.size()]; pScene->mMaterials = new aiMaterial*[materials.size()];
for (size_t i = 0; i < materials.size(); ++i) { for (size_t i = 0; i < materials.size(); ++i) {
MaterialHelper* mo = new MaterialHelper(); aiMaterial* mo = new aiMaterial();
pScene->mMaterials[pScene->mNumMaterials++] = mo; pScene->mMaterials[pScene->mNumMaterials++] = mo;
const TempMaterial& mi = materials[i]; const TempMaterial& mi = materials[i];

View File

@ -61,15 +61,12 @@ namespace Assimp {
* The step has been added because it was required by the viewer, however * The step has been added because it was required by the viewer, however
* it has been moved to the main library since others might find it * it has been moved to the main library since others might find it
* useful, too. */ * useful, too. */
class ASSIMP_API MakeVerboseFormatProcess : public BaseProcess class ASSIMP_API_WINONLY MakeVerboseFormatProcess : public BaseProcess
{ {
public: public:
/** Constructor to be privately used by Importer, or by applications
which know what they are doing if they modify the aiScene object */
MakeVerboseFormatProcess();
/** Destructor, private as well */ MakeVerboseFormatProcess();
~MakeVerboseFormatProcess(); ~MakeVerboseFormatProcess();
public: public:

View File

@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Hash.h" #include "Hash.h"
#include "fast_atof.h" #include "fast_atof.h"
#include "ParsingUtils.h" #include "ParsingUtils.h"
#include "MaterialSystem.h"
using namespace Assimp; using namespace Assimp;
@ -353,7 +354,7 @@ aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Construction. Actually the one and only way to get an aiMaterial instance // Construction. Actually the one and only way to get an aiMaterial instance
MaterialHelper::MaterialHelper() aiMaterial::aiMaterial()
{ {
// Allocate 5 entries by default // Allocate 5 entries by default
mNumProperties = 0; mNumProperties = 0;
@ -361,39 +362,16 @@ MaterialHelper::MaterialHelper()
mProperties = new aiMaterialProperty*[5]; mProperties = new aiMaterialProperty*[5];
} }
// ------------------------------------------------------------------------------------------------
MaterialHelper::~MaterialHelper()
{
_InternDestruct();
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiMaterial::~aiMaterial() aiMaterial::~aiMaterial()
{ {
// HACK (Aramis): This is safe: aiMaterial has a private constructor,
// so instances must be created indirectly via MaterialHelper. We can't
// use a virtual d'tor because we need to preserve binary compatibility
// with good old C ...
((MaterialHelper*)this)->_InternDestruct();
}
// ------------------------------------------------------------------------------------------------
// Manual destructor
void MaterialHelper::_InternDestruct()
{
// First clean up all properties
Clear(); Clear();
// Then delete the array that stored them
delete[] mProperties; delete[] mProperties;
AI_DEBUG_INVALIDATE_PTR(mProperties);
// Update members
mNumAllocated = 0;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void MaterialHelper::Clear() void aiMaterial::Clear()
{ {
for (unsigned int i = 0; i < mNumProperties;++i) { for (unsigned int i = 0; i < mNumProperties;++i) {
// delete this entry // delete this entry
@ -406,29 +384,7 @@ void MaterialHelper::Clear()
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
uint32_t MaterialHelper::ComputeHash(bool includeMatName /*= false*/) aiReturn aiMaterial::RemoveProperty (const char* pKey,unsigned int type,
{
uint32_t hash = 1503; // magic start value, choosen to be my birthday :-)
for (unsigned int i = 0; i < mNumProperties;++i) {
aiMaterialProperty* prop;
// Exclude all properties whose first character is '?' from the hash
// See doc for aiMaterialProperty.
if ((prop = mProperties[i]) && (includeMatName || prop->mKey.data[0] != '?')) {
hash = SuperFastHash(prop->mKey.data,(unsigned int)prop->mKey.length,hash);
hash = SuperFastHash(prop->mData,prop->mDataLength,hash);
// Combine the semantic and the index with the hash
hash = SuperFastHash((const char*)&prop->mSemantic,sizeof(unsigned int),hash);
hash = SuperFastHash((const char*)&prop->mIndex,sizeof(unsigned int),hash);
}
}
return hash;
}
// ------------------------------------------------------------------------------------------------
aiReturn MaterialHelper::RemoveProperty (const char* pKey,unsigned int type,
unsigned int index unsigned int index
) )
{ {
@ -456,7 +412,7 @@ aiReturn MaterialHelper::RemoveProperty (const char* pKey,unsigned int type,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiReturn MaterialHelper::AddBinaryProperty (const void* pInput, aiReturn aiMaterial::AddBinaryProperty (const void* pInput,
unsigned int pSizeInBytes, unsigned int pSizeInBytes,
const char* pKey, const char* pKey,
unsigned int type, unsigned int type,
@ -526,7 +482,7 @@ aiReturn MaterialHelper::AddBinaryProperty (const void* pInput,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiReturn MaterialHelper::AddProperty (const aiString* pInput, aiReturn aiMaterial::AddProperty (const aiString* pInput,
const char* pKey, const char* pKey,
unsigned int type, unsigned int type,
unsigned int index) unsigned int index)
@ -557,8 +513,30 @@ aiReturn MaterialHelper::AddProperty (const aiString* pInput,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void MaterialHelper::CopyPropertyList(MaterialHelper* pcDest, uint32_t Assimp :: ComputeMaterialHash(const aiMaterial* mat, bool includeMatName /*= false*/)
const MaterialHelper* pcSrc {
uint32_t hash = 1503; // magic start value, chosen to be my birthday :-)
for (unsigned int i = 0; i < mat->mNumProperties;++i) {
aiMaterialProperty* prop;
// Exclude all properties whose first character is '?' from the hash
// See doc for aiMaterialProperty.
if ((prop = mat->mProperties[i]) && (includeMatName || prop->mKey.data[0] != '?')) {
hash = SuperFastHash(prop->mKey.data,(unsigned int)prop->mKey.length,hash);
hash = SuperFastHash(prop->mData,prop->mDataLength,hash);
// Combine the semantic and the index with the hash
hash = SuperFastHash((const char*)&prop->mSemantic,sizeof(unsigned int),hash);
hash = SuperFastHash((const char*)&prop->mIndex,sizeof(unsigned int),hash);
}
}
return hash;
}
// ------------------------------------------------------------------------------------------------
void aiMaterial::CopyPropertyList(aiMaterial* pcDest,
const aiMaterial* pcSrc
) )
{ {
ai_assert(NULL != pcDest); ai_assert(NULL != pcDest);

View File

@ -39,208 +39,28 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/** @file MaterialSystem.h /** @file MaterialSystem.h
* Definition of the #MaterialHelper utility class. * Now that #MaterialHelper is gone, this file only contains some
* internal material utility functions.
*/ */
#ifndef AI_MATERIALSYSTEM_H_INC #ifndef AI_MATERIALSYSTEM_H_INC
#define AI_MATERIALSYSTEM_H_INC #define AI_MATERIALSYSTEM_H_INC
#include "../include/aiMaterial.h"
namespace Assimp { namespace Assimp {
// ----------------------------------------------------------------------------------------
/** Internal material helper class deriving from aiMaterial.
*
* Intended to be used to fill an aiMaterial structure more easily.
*/
class ASSIMP_API MaterialHelper : public ::aiMaterial
{
public:
// Construction and destruction
MaterialHelper();
~MaterialHelper();
// ------------------------------------------------------------------------------
/** @brief Add a property with a given key and type info to the material
* structure
*
* @param pInput Pointer to input data
* @param pSizeInBytes Size of input data
* @param pKey Key/Usage of the property (AI_MATKEY_XXX)
* @param type Set by the AI_MATKEY_XXX macro
* @param index Set by the AI_MATKEY_XXX macro
* @param pType Type information hint
*/
aiReturn AddBinaryProperty (const void* pInput,
unsigned int pSizeInBytes,
const char* pKey,
unsigned int type ,
unsigned int index ,
aiPropertyTypeInfo pType);
// ------------------------------------------------------------------------------
/** @brief Add a string property with a given key and type info to the
* material structure
*
* @param pInput Input string
* @param pKey Key/Usage of the property (AI_MATKEY_XXX)
* @param type Set by the AI_MATKEY_XXX macro
* @param index Set by the AI_MATKEY_XXX macro
*/
aiReturn AddProperty (const aiString* pInput,
const char* pKey,
unsigned int type = 0,
unsigned int index = 0);
// ------------------------------------------------------------------------------
/** @brief Add a property with a given key to the material structure
* @param pInput Pointer to the input data
* @param pNumValues Number of values in the array
* @param pKey Key/Usage of the property (AI_MATKEY_XXX)
* @param type Set by the AI_MATKEY_XXX macro
* @param index Set by the AI_MATKEY_XXX macro
*/
template<class TYPE>
aiReturn AddProperty (const TYPE* pInput,
unsigned int pNumValues,
const char* pKey,
unsigned int type = 0,
unsigned int index = 0);
// ------------------------------------------------------------------------------
/** @brief Remove a given key from the list.
*
* The function fails if the key isn't found
* @param pKey Key to be deleted
*/
aiReturn RemoveProperty (const char* pKey,
unsigned int type = 0,
unsigned int index = 0);
// ------------------------------------------------------------------------------
/** @brief Removes all properties from the material.
*
* The data array remains allocated so adding new properties is quite fast.
*/
void Clear();
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
/** Computes a hash (hopefully unique) from all material properties /** Computes a hash (hopefully unique) from all material properties
* The hash value reflects the current property state, so if you add any * The hash value reflects the current property state, so if you add any
* proprty and call this method again, the resulting hash value will be * property and call this method again, the resulting hash value will be
* different. * different. The hash is not persistent across different builds and platforms.
* *
* @param includeMatName Set to 'true' to take all properties with * @param includeMatName Set to 'true' to take all properties with
* '?' as initial character in their name into account. * '?' as initial character in their name into account.
* Currently #AI_MATKEY_NAME is the only example. * Currently #AI_MATKEY_NAME is the only example.
* @return Unique hash * @return 32 Bit jash value for the material
*/ */
uint32_t ComputeHash(bool includeMatName = false); uint32_t ComputeMaterialHash(const aiMaterial* mat, bool includeMatName = false);
// ------------------------------------------------------------------------------
/** Copy the property list of a material
* @param pcDest Destination material
* @param pcSrc Source material
*/
static void CopyPropertyList(MaterialHelper* pcDest,
const MaterialHelper* pcSrc);
public:
// For internal use. That's why it's public.
void _InternDestruct();
};
// ----------------------------------------------------------------------------------------
template<class TYPE>
aiReturn MaterialHelper::AddProperty (const TYPE* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
unsigned int index)
{
return AddBinaryProperty((const void*)pInput,
pNumValues * sizeof(TYPE),
pKey,type,index,aiPTI_Buffer);
}
// ----------------------------------------------------------------------------------------
template<>
inline aiReturn MaterialHelper::AddProperty<float> (const float* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
unsigned int index)
{
return AddBinaryProperty((const void*)pInput,
pNumValues * sizeof(float),
pKey,type,index,aiPTI_Float);
}
// ----------------------------------------------------------------------------------------
template<>
inline aiReturn MaterialHelper::AddProperty<aiUVTransform> (const aiUVTransform* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
unsigned int index)
{
return AddBinaryProperty((const void*)pInput,
pNumValues * sizeof(aiUVTransform),
pKey,type,index,aiPTI_Float);
}
// ----------------------------------------------------------------------------------------
template<>
inline aiReturn MaterialHelper::AddProperty<aiColor4D> (const aiColor4D* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
unsigned int index)
{
return AddBinaryProperty((const void*)pInput,
pNumValues * sizeof(aiColor4D),
pKey,type,index,aiPTI_Float);
}
// ----------------------------------------------------------------------------------------
template<>
inline aiReturn MaterialHelper::AddProperty<aiColor3D> (const aiColor3D* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
unsigned int index)
{
return AddBinaryProperty((const void*)pInput,
pNumValues * sizeof(aiColor3D),
pKey,type,index,aiPTI_Float);
}
// ----------------------------------------------------------------------------------------
template<>
inline aiReturn MaterialHelper::AddProperty<aiVector3D> (const aiVector3D* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
unsigned int index)
{
return AddBinaryProperty((const void*)pInput,
pNumValues * sizeof(aiVector3D),
pKey,type,index,aiPTI_Float);
}
// ----------------------------------------------------------------------------------------
template<>
inline aiReturn MaterialHelper::AddProperty<int> (const int* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
unsigned int index)
{
return AddBinaryProperty((const void*)pInput,
pNumValues * sizeof(int),
pKey,type,index,aiPTI_Integer);
}
} // ! namespace Assimp } // ! namespace Assimp
#endif //!! AI_MATERIALSYSTEM_H_INC #endif //!! AI_MATERIALSYSTEM_H_INC

View File

@ -1195,7 +1195,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
} }
// generate a material for the mesh // generate a material for the mesh
MaterialHelper* pcMat = (MaterialHelper*)(pScene->mMaterials[m] = new MaterialHelper()); aiMaterial* pcMat = (aiMaterial*)(pScene->mMaterials[m] = new aiMaterial());
mesh->mMaterialIndex = m++; mesh->mMaterialIndex = m++;

View File

@ -198,7 +198,7 @@ void OFFImporter::InternReadFile( const std::string& pFile,
// generate a default material // generate a default material
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = 1]; pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = 1];
MaterialHelper* pcMat = new MaterialHelper(); aiMaterial* pcMat = new aiMaterial();
aiColor4D clr(0.6f,0.6f,0.6f,1.0f); aiColor4D clr(0.6f,0.6f,0.6f,1.0f);
pcMat->AddProperty(&clr,1,AI_MATKEY_COLOR_DIFFUSE); pcMat->AddProperty(&clr,1,AI_MATKEY_COLOR_DIFFUSE);

View File

@ -55,7 +55,7 @@ namespace Assimp
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
/** Helper class to export a given scene to an OBJ file. */ /** Helper class to export a given scene to an OBJ file. */
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
class ASSIMP_API ObjExporter class ObjExporter
{ {
public: public:
/// Constructor for a specific scene to export /// Constructor for a specific scene to export

View File

@ -415,7 +415,7 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
pScene->mMaterials = new aiMaterial*[ numMaterials ]; pScene->mMaterials = new aiMaterial*[ numMaterials ];
for ( unsigned int matIndex = 0; matIndex < numMaterials; matIndex++ ) for ( unsigned int matIndex = 0; matIndex < numMaterials; matIndex++ )
{ {
Assimp::MaterialHelper* mat = new Assimp::MaterialHelper; aiMaterial* mat = new aiMaterial;
// Store material name // Store material name
std::map<std::string, ObjFile::Material*>::const_iterator it; std::map<std::string, ObjFile::Material*>::const_iterator it;

View File

@ -71,7 +71,7 @@ aiMaterial* OgreImporter::LoadMaterial(const std::string MaterialName) const
const aiScene* const m_CurrentScene=this->m_CurrentScene;//make sure, that we can access but not change the scene const aiScene* const m_CurrentScene=this->m_CurrentScene;//make sure, that we can access but not change the scene
(void)m_CurrentScene; (void)m_CurrentScene;
MaterialHelper *NewMaterial=new MaterialHelper(); aiMaterial *NewMaterial=new aiMaterial();
aiString ts(MaterialName.c_str()); aiString ts(MaterialName.c_str());
NewMaterial->AddProperty(&ts, AI_MATKEY_NAME); NewMaterial->AddProperty(&ts, AI_MATKEY_NAME);

View File

@ -61,7 +61,7 @@ namespace Assimp {
* @see aiProcess_OptimizeGraph for a detailed description of the * @see aiProcess_OptimizeGraph for a detailed description of the
* algorithm being applied. * algorithm being applied.
*/ */
class ASSIMP_API OptimizeGraphProcess : public BaseProcess class OptimizeGraphProcess : public BaseProcess
{ {
public: public:

View File

@ -59,7 +59,7 @@ namespace Assimp {
* *
* @note Instanced meshes are currently not processed. * @note Instanced meshes are currently not processed.
*/ */
class ASSIMP_API OptimizeMeshesProcess : public BaseProcess class OptimizeMeshesProcess : public BaseProcess
{ {
public: public:

View File

@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "PlyLoader.h" #include "PlyLoader.h"
#include "MaterialSystem.h"
using namespace Assimp; using namespace Assimp;
@ -188,7 +187,7 @@ void PLYImporter::InternReadFile( const std::string& pFile,
} }
// now load a list of all materials // now load a list of all materials
std::vector<MaterialHelper*> avMaterials; std::vector<aiMaterial*> avMaterials;
LoadMaterial(&avMaterials); LoadMaterial(&avMaterials);
// now load a list of all vertex color channels // now load a list of all vertex color channels
@ -241,7 +240,7 @@ void PLYImporter::ConvertMeshes(std::vector<PLY::Face>* avFaces,
const std::vector<aiVector3D>* avNormals, const std::vector<aiVector3D>* avNormals,
const std::vector<aiColor4D>* avColors, const std::vector<aiColor4D>* avColors,
const std::vector<aiVector2D>* avTexCoords, const std::vector<aiVector2D>* avTexCoords,
const std::vector<MaterialHelper*>* avMaterials, const std::vector<aiMaterial*>* avMaterials,
std::vector<aiMesh*>* avOut) std::vector<aiMesh*>* avOut)
{ {
ai_assert(NULL != avFaces); ai_assert(NULL != avFaces);
@ -327,7 +326,7 @@ void PLYImporter::ConvertMeshes(std::vector<PLY::Face>* avFaces,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Generate a default material if none was specified and apply it to all vanilla faces // Generate a default material if none was specified and apply it to all vanilla faces
void PLYImporter::ReplaceDefaultMaterial(std::vector<PLY::Face>* avFaces, void PLYImporter::ReplaceDefaultMaterial(std::vector<PLY::Face>* avFaces,
std::vector<MaterialHelper*>* avMaterials) std::vector<aiMaterial*>* avMaterials)
{ {
bool bNeedDefaultMat = false; bool bNeedDefaultMat = false;
@ -344,7 +343,7 @@ void PLYImporter::ReplaceDefaultMaterial(std::vector<PLY::Face>* avFaces,
if (bNeedDefaultMat) { if (bNeedDefaultMat) {
// generate a default material // generate a default material
MaterialHelper* pcHelper = new MaterialHelper(); aiMaterial* pcHelper = new aiMaterial();
// fill in a default material // fill in a default material
int iMode = (int)aiShadingMode_Gouraud; int iMode = (int)aiShadingMode_Gouraud;
@ -869,7 +868,7 @@ void PLYImporter::GetMaterialColor(const std::vector<PLY::PropertyInstance>& avL
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Extract a material from the PLY DOM // Extract a material from the PLY DOM
void PLYImporter::LoadMaterial(std::vector<MaterialHelper*>* pvOut) void PLYImporter::LoadMaterial(std::vector<aiMaterial*>* pvOut)
{ {
ai_assert(NULL != pvOut); ai_assert(NULL != pvOut);
@ -997,7 +996,7 @@ void PLYImporter::LoadMaterial(std::vector<MaterialHelper*>* pvOut)
if (NULL != pcList) { if (NULL != pcList) {
for (std::vector<ElementInstance>::const_iterator i = pcList->alInstances.begin();i != pcList->alInstances.end();++i) { for (std::vector<ElementInstance>::const_iterator i = pcList->alInstances.begin();i != pcList->alInstances.end();++i) {
aiColor4D clrOut; aiColor4D clrOut;
MaterialHelper* pcHelper = new MaterialHelper(); aiMaterial* pcHelper = new aiMaterial();
// build the diffuse material color // build the diffuse material color
GetMaterialColor((*i).alProperties,aaiPositions[0],aaiTypes[0],&clrOut); GetMaterialColor((*i).alProperties,aaiPositions[0],aaiTypes[0],&clrOut);

View File

@ -52,7 +52,7 @@ struct aiNode;
#include "PlyParser.h" #include "PlyParser.h"
namespace Assimp { namespace Assimp {
class MaterialHelper;
using namespace PLY; using namespace PLY;
@ -117,14 +117,14 @@ protected:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Extract a material list from the DOM /** Extract a material list from the DOM
*/ */
void LoadMaterial(std::vector<MaterialHelper*>* pvOut); void LoadMaterial(std::vector<aiMaterial*>* pvOut);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Validate material indices, replace default material identifiers /** Validate material indices, replace default material identifiers
*/ */
void ReplaceDefaultMaterial(std::vector<PLY::Face>* avFaces, void ReplaceDefaultMaterial(std::vector<PLY::Face>* avFaces,
std::vector<MaterialHelper*>* avMaterials); std::vector<aiMaterial*>* avMaterials);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -135,7 +135,7 @@ protected:
const std::vector<aiVector3D>* avNormals, const std::vector<aiVector3D>* avNormals,
const std::vector<aiColor4D>* avColors, const std::vector<aiColor4D>* avColors,
const std::vector<aiVector2D>* avTexCoords, const std::vector<aiVector2D>* avTexCoords,
const std::vector<MaterialHelper*>* avMaterials, const std::vector<aiMaterial*>* avMaterials,
std::vector<aiMesh*>* avOut); std::vector<aiMesh*>* avOut);

View File

@ -56,7 +56,7 @@ namespace Assimp {
* and removes the whole graph. The output is a list of meshes, one for * and removes the whole graph. The output is a list of meshes, one for
* each material. * each material.
*/ */
class ASSIMP_API PretransformVertices : public BaseProcess class PretransformVertices : public BaseProcess
{ {
public: public:

View File

@ -481,7 +481,7 @@ void Q3BSPFileImporter::createMaterials( const Q3BSP::Q3BSPModel *pModel, aiScen
} }
aiMatName.Set( matName ); aiMatName.Set( matName );
Assimp::MaterialHelper *pMatHelper = new Assimp::MaterialHelper; aiMaterial *pMatHelper = new aiMaterial;
pMatHelper->AddProperty( &aiMatName, AI_MATKEY_NAME ); pMatHelper->AddProperty( &aiMatName, AI_MATKEY_NAME );
extractIds( matName, textureId, lightmapId ); extractIds( matName, textureId, lightmapId );
@ -623,7 +623,7 @@ aiFace *Q3BSPFileImporter::getNextFace( aiMesh *pMesh, unsigned int &rFaceIdx )
// Imports a texture file. // Imports a texture file.
bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pModel, bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pModel,
Q3BSP::Q3BSPZipArchive *pArchive, aiScene* /*pScene*/, Q3BSP::Q3BSPZipArchive *pArchive, aiScene* /*pScene*/,
Assimp::MaterialHelper *pMatHelper, int textureId ) aiMaterial *pMatHelper, int textureId )
{ {
std::vector<std::string> supportedExtensions; std::vector<std::string> supportedExtensions;
supportedExtensions.push_back( ".jpg" ); supportedExtensions.push_back( ".jpg" );
@ -690,7 +690,7 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pMode
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports a light map file. // Imports a light map file.
bool Q3BSPFileImporter::importLightmap( const Q3BSP::Q3BSPModel *pModel, aiScene* pScene, bool Q3BSPFileImporter::importLightmap( const Q3BSP::Q3BSPModel *pModel, aiScene* pScene,
Assimp::MaterialHelper *pMatHelper, int lightmapId ) aiMaterial *pMatHelper, int lightmapId )
{ {
if ( NULL == pModel || NULL == pScene || NULL == pMatHelper ) if ( NULL == pModel || NULL == pScene || NULL == pMatHelper )
{ {

View File

@ -95,8 +95,8 @@ private:
void createMaterialMap( const Q3BSP::Q3BSPModel *pModel); void createMaterialMap( const Q3BSP::Q3BSPModel *pModel);
aiFace *getNextFace( aiMesh *pMesh, unsigned int &rFaceIdx ); aiFace *getNextFace( aiMesh *pMesh, unsigned int &rFaceIdx );
bool importTextureFromArchive( const Q3BSP::Q3BSPModel *pModel, Q3BSP::Q3BSPZipArchive *pArchive, aiScene* pScene, bool importTextureFromArchive( const Q3BSP::Q3BSPModel *pModel, Q3BSP::Q3BSPZipArchive *pArchive, aiScene* pScene,
Assimp::MaterialHelper *pMatHelper, int textureId ); aiMaterial *pMatHelper, int textureId );
bool importLightmap( const Q3BSP::Q3BSPModel *pModel, aiScene* pScene, Assimp::MaterialHelper *pMatHelper, int lightmapId ); bool importLightmap( const Q3BSP::Q3BSPModel *pModel, aiScene* pScene, aiMaterial *pMatHelper, int lightmapId );
bool importEntities( const Q3BSP::Q3BSPModel *pModel, aiScene* pScene ); bool importEntities( const Q3BSP::Q3BSPModel *pModel, aiScene* pScene );
bool expandFile( Q3BSP::Q3BSPZipArchive *pArchive, const std::string &rFilename, const std::vector<std::string> &rExtList, bool expandFile( Q3BSP::Q3BSPZipArchive *pArchive, const std::string &rFilename, const std::vector<std::string> &rExtList,
std::string &rFile, std::string &rExt ); std::string &rFile, std::string &rExt );

View File

@ -433,7 +433,7 @@ outer:
// Allocate a mesh and a material // Allocate a mesh and a material
aiMesh* mesh = pScene->mMeshes[real] = new aiMesh(); aiMesh* mesh = pScene->mMeshes[real] = new aiMesh();
MaterialHelper* mat = new MaterialHelper(); aiMaterial* mat = new aiMaterial();
pScene->mMaterials[real] = mat; pScene->mMaterials[real] = mat;
mesh->mMaterialIndex = real; mesh->mMaterialIndex = real;

View File

@ -290,7 +290,7 @@ void RAWImporter::InternReadFile( const std::string& pFile,
} }
// generate a material for the mesh // generate a material for the mesh
MaterialHelper* mat = new MaterialHelper(); aiMaterial* mat = new aiMaterial();
aiColor4D clr(1.0f,1.0f,1.0f,1.0f); aiColor4D clr(1.0f,1.0f,1.0f,1.0f);
if ("%default%" == (*it2).name) // a gray default material if ("%default%" == (*it2).name) // a gray default material

View File

@ -55,7 +55,7 @@ namespace Assimp {
* to those in C or C++ so this code has been moved to a separate * to those in C or C++ so this code has been moved to a separate
* module. * module.
*/ */
class ASSIMP_API CommentRemover class CommentRemover
{ {
// class cannot be instanced // class cannot be instanced
CommentRemover() {} CommentRemover() {}

View File

@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "RemoveRedundantMaterials.h" #include "RemoveRedundantMaterials.h"
#include "ParsingUtils.h" #include "ParsingUtils.h"
#include "ProcessHelper.h" #include "ProcessHelper.h"
#include "MaterialSystem.h"
using namespace Assimp; using namespace Assimp;
@ -114,7 +115,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
// Our brilliant 'salt': A single material property with ~ as first // Our brilliant 'salt': A single material property with ~ as first
// character to mark it as internal and temporary. // character to mark it as internal and temporary.
const int dummy = 1; const int dummy = 1;
((MaterialHelper*)mat)->AddProperty(&dummy,1,"~RRM.UniqueMaterial",0,0); ((aiMaterial*)mat)->AddProperty(&dummy,1,"~RRM.UniqueMaterial",0,0);
// Keep this material even if no mesh references it // Keep this material even if no mesh references it
abReferenced[i] = true; abReferenced[i] = true;
@ -144,7 +145,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
continue; continue;
} }
uint32_t me = aiHashes[i] = ((MaterialHelper*)pScene->mMaterials[i])->ComputeHash(); uint32_t me = aiHashes[i] = ComputeMaterialHash(pScene->mMaterials[i]);
for (unsigned int a = 0; a < i;++a) for (unsigned int a = 0; a < i;++a)
{ {
if (abReferenced[a] && me == aiHashes[a]) { if (abReferenced[a] && me == aiHashes[a]) {
@ -175,7 +176,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
{ {
aiString sz; aiString sz;
sz.length = ::sprintf(sz.data,"JoinedMaterial_#%i",p); sz.length = ::sprintf(sz.data,"JoinedMaterial_#%i",p);
((MaterialHelper*)ppcMaterials[idx])->AddProperty(&sz,AI_MATKEY_NAME); ((aiMaterial*)ppcMaterials[idx])->AddProperty(&sz,AI_MATKEY_NAME);
} }
else ppcMaterials[idx] = pScene->mMaterials[p]; else ppcMaterials[idx] = pScene->mMaterials[p];
} }

View File

@ -54,7 +54,7 @@ namespace Assimp {
/** RemoveRedundantMatsProcess: Postprocessing steo to remove redundant /** RemoveRedundantMatsProcess: Postprocessing steo to remove redundant
* materials from the imported scene. * materials from the imported scene.
*/ */
class ASSIMP_API RemoveRedundantMatsProcess : public BaseProcess class RemoveRedundantMatsProcess : public BaseProcess
{ {
public: public:

View File

@ -167,7 +167,7 @@ void RemoveVCProcess::Execute( aiScene* pScene)
delete pScene->mMaterials[i]; delete pScene->mMaterials[i];
pScene->mNumMaterials = 1; pScene->mNumMaterials = 1;
MaterialHelper* helper = (MaterialHelper*) pScene->mMaterials[0]; aiMaterial* helper = (aiMaterial*) pScene->mMaterials[0];
ai_assert(NULL != helper); ai_assert(NULL != helper);
helper->Clear(); helper->Clear();

View File

@ -52,7 +52,7 @@ namespace Assimp {
/** RemoveVCProcess: Class to exclude specific parts of the data structure /** RemoveVCProcess: Class to exclude specific parts of the data structure
* from further processing by removing them, * from further processing by removing them,
*/ */
class ASSIMP_API RemoveVCProcess : public BaseProcess class RemoveVCProcess : public BaseProcess
{ {
public: public:

View File

@ -625,7 +625,7 @@ void SMDImporter::CreateOutputMaterials()
for (unsigned int iMat = 0; iMat < pScene->mNumMaterials;++iMat) for (unsigned int iMat = 0; iMat < pScene->mNumMaterials;++iMat)
{ {
MaterialHelper* pcMat = new MaterialHelper(); aiMaterial* pcMat = new aiMaterial();
pScene->mMaterials[iMat] = pcMat; pScene->mMaterials[iMat] = pcMat;
aiString szName; aiString szName;
@ -645,7 +645,7 @@ void SMDImporter::CreateOutputMaterials()
{ {
pScene->mNumMaterials = 1; pScene->mNumMaterials = 1;
MaterialHelper* pcHelper = new MaterialHelper(); aiMaterial* pcHelper = new aiMaterial();
pScene->mMaterials[0] = pcHelper; pScene->mMaterials[0] = pcHelper;
int iMode = (int)aiShadingMode_Gouraud; int iMode = (int)aiShadingMode_Gouraud;

View File

@ -60,7 +60,7 @@ struct aiNode;
#include <vector> #include <vector>
namespace Assimp { namespace Assimp {
class MaterialHelper;
namespace SMD { namespace SMD {

View File

@ -55,7 +55,7 @@ namespace Assimp
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
/** Helper class to export a given scene to a STL file. */ /** Helper class to export a given scene to a STL file. */
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
class ASSIMP_API STLExporter class STLExporter
{ {
public: public:
/// Constructor for a specific scene to export /// Constructor for a specific scene to export

View File

@ -143,7 +143,7 @@ void STLImporter::InternReadFile( const std::string& pFile,
} }
// create a single default material - everything white, as we have vertex colors // create a single default material - everything white, as we have vertex colors
MaterialHelper* pcMat = new MaterialHelper(); aiMaterial* pcMat = new aiMaterial();
aiString s; aiString s;
s.Set(AI_DEFAULT_MATERIAL_NAME); s.Set(AI_DEFAULT_MATERIAL_NAME);
pcMat->AddProperty(&s, AI_MATKEY_NAME); pcMat->AddProperty(&s, AI_MATKEY_NAME);

View File

@ -245,7 +245,6 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
// if _dest points to NULL allocate a new scene. Otherwise clear the old and reuse it // if _dest points to NULL allocate a new scene. Otherwise clear the old and reuse it
if (srcList.empty()) { if (srcList.empty()) {
if (*_dest) { if (*_dest) {
(*_dest)->~aiScene();
SceneCombiner::CopySceneFlat(_dest,master); SceneCombiner::CopySceneFlat(_dest,master);
} }
else *_dest = master; else *_dest = master;
@ -253,6 +252,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
} }
if (*_dest) { if (*_dest) {
(*_dest)->~aiScene(); (*_dest)->~aiScene();
new (*_dest) aiScene();
} }
else *_dest = new aiScene(); else *_dest = new aiScene();
@ -910,7 +910,10 @@ inline void GetArrayCopy (Type*& dest, unsigned int num )
void SceneCombiner::CopySceneFlat(aiScene** _dest,const aiScene* src) void SceneCombiner::CopySceneFlat(aiScene** _dest,const aiScene* src)
{ {
// reuse the old scene or allocate a new? // reuse the old scene or allocate a new?
if (*_dest)(*_dest)->~aiScene(); if (*_dest) {
(*_dest)->~aiScene();
new (*_dest) aiScene();
}
else *_dest = new aiScene(); else *_dest = new aiScene();
::memcpy(*_dest,src,sizeof(aiScene)); ::memcpy(*_dest,src,sizeof(aiScene));
@ -1008,7 +1011,7 @@ void SceneCombiner::Copy (aiMaterial** _dest, const aiMaterial* src)
{ {
ai_assert(NULL != _dest && NULL != src); ai_assert(NULL != _dest && NULL != src);
MaterialHelper* dest = (MaterialHelper*) ( *_dest = new MaterialHelper() ); aiMaterial* dest = (aiMaterial*) ( *_dest = new aiMaterial() );
dest->mNumAllocated = src->mNumAllocated; dest->mNumAllocated = src->mNumAllocated;
dest->mNumProperties = src->mNumProperties; dest->mNumProperties = src->mNumProperties;
dest->mProperties = new aiMaterialProperty* [dest->mNumAllocated]; dest->mProperties = new aiMaterialProperty* [dest->mNumAllocated];

View File

@ -178,7 +178,7 @@ struct SceneHelper
* The class is currently being used by various postprocessing steps * The class is currently being used by various postprocessing steps
* and loaders (ie. LWS). * and loaders (ie. LWS).
*/ */
class ASSIMP_API SceneCombiner class SceneCombiner
{ {
// class cannot be instanced // class cannot be instanced
SceneCombiner() {} SceneCombiner() {}

View File

@ -64,7 +64,7 @@ void ScenePreprocessor::ProcessScene ()
// Generate a default material if none was specified // Generate a default material if none was specified
if (!scene->mNumMaterials && scene->mNumMeshes) { if (!scene->mNumMaterials && scene->mNumMeshes) {
scene->mMaterials = new aiMaterial*[2]; scene->mMaterials = new aiMaterial*[2];
MaterialHelper* helper; aiMaterial* helper;
aiString name; aiString name;
@ -76,7 +76,7 @@ void ScenePreprocessor::ProcessScene ()
if (mat0 == UINT_MAX) { if (mat0 == UINT_MAX) {
scene->mMaterials[scene->mNumMaterials] = helper = new MaterialHelper(); scene->mMaterials[scene->mNumMaterials] = helper = new aiMaterial();
name.Set("$texture.png"); name.Set("$texture.png");
helper->AddProperty(&name,AI_MATKEY_TEXTURE_DIFFUSE(0)); helper->AddProperty(&name,AI_MATKEY_TEXTURE_DIFFUSE(0));
@ -91,7 +91,7 @@ void ScenePreprocessor::ProcessScene ()
else { else {
if (mat1 == UINT_MAX) { if (mat1 == UINT_MAX) {
scene->mMaterials[scene->mNumMaterials] = helper = new MaterialHelper(); scene->mMaterials[scene->mNumMaterials] = helper = new aiMaterial();
aiColor3D clr(0.6f,0.6f,0.6f); aiColor3D clr(0.6f,0.6f,0.6f);
helper->AddProperty(&clr,1,AI_MATKEY_COLOR_DIFFUSE); helper->AddProperty(&clr,1,AI_MATKEY_COLOR_DIFFUSE);

View File

@ -54,7 +54,7 @@ namespace Assimp {
* importer, such as aiMesh::mPrimitiveTypes. * importer, such as aiMesh::mPrimitiveTypes.
*/ */
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
class ASSIMP_API ScenePreprocessor class ScenePreprocessor
{ {
// Make ourselves a friend of the corresponding test unit. // Make ourselves a friend of the corresponding test unit.
friend class ::ScenePreprocessorTest; friend class ::ScenePreprocessorTest;

View File

@ -253,7 +253,7 @@ aiMesh* SkeletonMeshBuilder::CreateMesh()
// Creates a dummy material and returns it. // Creates a dummy material and returns it.
aiMaterial* SkeletonMeshBuilder::CreateMaterial() aiMaterial* SkeletonMeshBuilder::CreateMaterial()
{ {
Assimp::MaterialHelper* matHelper = new Assimp::MaterialHelper; aiMaterial* matHelper = new aiMaterial;
// Name // Name
aiString matName( std::string( "SkeletonMaterial")); aiString matName( std::string( "SkeletonMaterial"));

View File

@ -62,7 +62,7 @@ namespace Assimp {
* the resembles the node hierarchy. This is useful for file formats * the resembles the node hierarchy. This is useful for file formats
* that don't carry any mesh data but only animation data. * that don't carry any mesh data but only animation data.
*/ */
class ASSIMP_API SkeletonMeshBuilder class SkeletonMeshBuilder
{ {
public: public:

View File

@ -55,7 +55,7 @@ namespace Assimp {
* A mesh with 5 lines, 3 points and 145 triangles would be split in 3 * A mesh with 5 lines, 3 points and 145 triangles would be split in 3
* submeshes. * submeshes.
*/ */
class ASSIMP_API SortByPTypeProcess : public BaseProcess class SortByPTypeProcess : public BaseProcess
{ {
public: public:

View File

@ -56,7 +56,7 @@ namespace Assimp
* time, with O(n) worst case complexity when all vertices lay on the plane. The plane is chosen * time, with O(n) worst case complexity when all vertices lay on the plane. The plane is chosen
* so that it avoids common planes in usual data sets. */ * so that it avoids common planes in usual data sets. */
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
class ASSIMP_API SpatialSort class SpatialSort
{ {
public: public:

View File

@ -59,7 +59,7 @@ namespace Assimp
* Applied BEFORE the JoinVertices-Step occurs. * Applied BEFORE the JoinVertices-Step occurs.
* Returns NON-UNIQUE vertices, splits by bone count. * Returns NON-UNIQUE vertices, splits by bone count.
*/ */
class ASSIMP_API SplitByBoneCountProcess : public BaseProcess class SplitByBoneCountProcess : public BaseProcess
{ {
public: public:

View File

@ -81,7 +81,7 @@ class SplitLargeMeshesProcess_Vertex;
* Applied BEFORE the JoinVertices-Step occurs. * Applied BEFORE the JoinVertices-Step occurs.
* Returns NON-UNIQUE vertices, splits by triangle number. * Returns NON-UNIQUE vertices, splits by triangle number.
*/ */
class ASSIMP_API SplitLargeMeshesProcess_Triangle : public BaseProcess class SplitLargeMeshesProcess_Triangle : public BaseProcess
{ {
friend class SplitLargeMeshesProcess_Vertex; friend class SplitLargeMeshesProcess_Vertex;
@ -149,7 +149,7 @@ public:
* Applied AFTER the JoinVertices-Step occurs. * Applied AFTER the JoinVertices-Step occurs.
* Returns UNIQUE vertices, splits by vertex number. * Returns UNIQUE vertices, splits by vertex number.
*/ */
class ASSIMP_API SplitLargeMeshesProcess_Vertex : public BaseProcess class SplitLargeMeshesProcess_Vertex : public BaseProcess
{ {
public: public:

View File

@ -53,7 +53,7 @@ namespace Assimp {
/** \brief Helper class to generate vertex buffers for standard geometric /** \brief Helper class to generate vertex buffers for standard geometric
* shapes, such as cylinders, cones, boxes, spheres, elipsoids ... . * shapes, such as cylinders, cones, boxes, spheres, elipsoids ... .
*/ */
class ASSIMP_API StandardShapes class StandardShapes
{ {
// class cannot be instanced // class cannot be instanced
StandardShapes() {} StandardShapes() {}

View File

@ -47,7 +47,7 @@ namespace Assimp {
/** Helper class to evaluate subdivision surfaces. Different algorithms /** Helper class to evaluate subdivision surfaces. Different algorithms
* are provided for choice. */ * are provided for choice. */
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
class ASSIMP_API Subdivider class Subdivider
{ {
public: public:

View File

@ -54,7 +54,7 @@ namespace Assimp {
* Missing tracks are interpolated. This is a helper class for * Missing tracks are interpolated. This is a helper class for
* TargetAnimationHelper, but it can be freely used for other purposes. * TargetAnimationHelper, but it can be freely used for other purposes.
*/ */
class ASSIMP_API KeyIterator class KeyIterator
{ {
public: public:
@ -126,7 +126,7 @@ private:
* channel for the camera/spot light itself and a separate position * channel for the camera/spot light itself and a separate position
* animation channels specifying the position of the camera/spot light * animation channels specifying the position of the camera/spot light
* look-at target */ * look-at target */
class ASSIMP_API TargetAnimationHelper class TargetAnimationHelper
{ {
public: public:

View File

@ -236,7 +236,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
// Setup a shortcut structure to allow for a fast updating // Setup a shortcut structure to allow for a fast updating
// of the UV index later // of the UV index later
TTUpdateInfo update; TTUpdateInfo update;
update.mat = (MaterialHelper*) mat; update.mat = (aiMaterial*) mat;
update.semantic = prop->mSemantic; update.semantic = prop->mSemantic;
update.index = prop->mIndex; update.index = prop->mIndex;

View File

@ -72,7 +72,7 @@ struct TTUpdateInfo
unsigned int* directShortcut; unsigned int* directShortcut;
//! Material //! Material
MaterialHelper *mat; aiMaterial *mat;
//! Texture type and index //! Texture type and index
unsigned int semantic, index; unsigned int semantic, index;
@ -188,7 +188,7 @@ struct STransformVecInfo : public aiUVTransform
/** Helper step to compute final UV coordinate sets if there are scalings /** Helper step to compute final UV coordinate sets if there are scalings
* or rotations in the original data read from the file. * or rotations in the original data read from the file.
*/ */
class ASSIMP_API TextureTransformStep : public BaseProcess class TextureTransformStep : public BaseProcess
{ {
public: public:

View File

@ -57,7 +57,7 @@ namespace Assimp
* into triangles. You usually want this to happen because the graphics cards * into triangles. You usually want this to happen because the graphics cards
* need their data as triangles. * need their data as triangles.
*/ */
class ASSIMP_API TriangulateProcess : public BaseProcess class TriangulateProcess : public BaseProcess
{ {
public: public:

View File

@ -350,7 +350,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
nd->mMeshes[i] = i; nd->mMeshes[i] = i;
// create materials, too // create materials, too
MaterialHelper* mat = new MaterialHelper(); aiMaterial* mat = new aiMaterial();
pScene->mMaterials[i] = mat; pScene->mMaterials[i] = mat;
// all white by default - texture rulez // all white by default - texture rulez

View File

@ -62,7 +62,7 @@ namespace Assimp {
/** Validates the whole ASSIMP scene data structure for correctness. /** Validates the whole ASSIMP scene data structure for correctness.
* ImportErrorException is thrown of the scene is corrupt.*/ * ImportErrorException is thrown of the scene is corrupt.*/
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
class ASSIMP_API ValidateDSProcess : public BaseProcess class ValidateDSProcess : public BaseProcess
{ {
public: public:

Some files were not shown because too many files have changed in this diff Show More