Merge pull request #90 from assimp/material-overloads
aiMaterial: use overloads instead of template specializations. This fixe...pull/95/head
commit
1b7ba63953
|
@ -691,6 +691,12 @@ public:
|
||||||
aiReturn Get(const char* pKey,unsigned int type,
|
aiReturn Get(const char* pKey,unsigned int type,
|
||||||
unsigned int idx, Type* pOut, unsigned int* pMax) const;
|
unsigned int idx, Type* pOut, unsigned int* pMax) const;
|
||||||
|
|
||||||
|
aiReturn Get(const char* pKey,unsigned int type,
|
||||||
|
unsigned int idx, int* pOut, unsigned int* pMax) const;
|
||||||
|
|
||||||
|
aiReturn Get(const char* pKey,unsigned int type,
|
||||||
|
unsigned int idx, float* pOut, unsigned int* pMax) const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** @brief Retrieve a Type value with a specific key
|
/** @brief Retrieve a Type value with a specific key
|
||||||
* from the material
|
* from the material
|
||||||
|
@ -705,6 +711,25 @@ public:
|
||||||
aiReturn Get(const char* pKey,unsigned int type,
|
aiReturn Get(const char* pKey,unsigned int type,
|
||||||
unsigned int idx,Type& pOut) const;
|
unsigned int idx,Type& pOut) const;
|
||||||
|
|
||||||
|
|
||||||
|
aiReturn Get(const char* pKey,unsigned int type,
|
||||||
|
unsigned int idx, int& pOut) const;
|
||||||
|
|
||||||
|
aiReturn Get(const char* pKey,unsigned int type,
|
||||||
|
unsigned int idx, float& pOut) const;
|
||||||
|
|
||||||
|
aiReturn Get(const char* pKey,unsigned int type,
|
||||||
|
unsigned int idx, aiString& pOut) const;
|
||||||
|
|
||||||
|
aiReturn Get(const char* pKey,unsigned int type,
|
||||||
|
unsigned int idx, aiColor3D& pOut) const;
|
||||||
|
|
||||||
|
aiReturn Get(const char* pKey,unsigned int type,
|
||||||
|
unsigned int idx, aiColor4D& pOut) const;
|
||||||
|
|
||||||
|
aiReturn Get(const char* pKey,unsigned int type,
|
||||||
|
unsigned int idx, aiUVTransform& pOut) const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Get the number of textures for a particular texture type.
|
/** Get the number of textures for a particular texture type.
|
||||||
* @param type Texture type to check for
|
* @param type Texture type to check for
|
||||||
|
@ -797,6 +822,42 @@ public:
|
||||||
unsigned int type = 0,
|
unsigned int type = 0,
|
||||||
unsigned int index = 0);
|
unsigned int index = 0);
|
||||||
|
|
||||||
|
aiReturn AddProperty (const aiVector3D* pInput,
|
||||||
|
unsigned int pNumValues,
|
||||||
|
const char* pKey,
|
||||||
|
unsigned int type = 0,
|
||||||
|
unsigned int index = 0);
|
||||||
|
|
||||||
|
aiReturn AddProperty (const aiColor3D* pInput,
|
||||||
|
unsigned int pNumValues,
|
||||||
|
const char* pKey,
|
||||||
|
unsigned int type = 0,
|
||||||
|
unsigned int index = 0);
|
||||||
|
|
||||||
|
aiReturn AddProperty (const aiColor4D* pInput,
|
||||||
|
unsigned int pNumValues,
|
||||||
|
const char* pKey,
|
||||||
|
unsigned int type = 0,
|
||||||
|
unsigned int index = 0);
|
||||||
|
|
||||||
|
aiReturn AddProperty (const int* pInput,
|
||||||
|
unsigned int pNumValues,
|
||||||
|
const char* pKey,
|
||||||
|
unsigned int type = 0,
|
||||||
|
unsigned int index = 0);
|
||||||
|
|
||||||
|
aiReturn AddProperty (const float* pInput,
|
||||||
|
unsigned int pNumValues,
|
||||||
|
const char* pKey,
|
||||||
|
unsigned int type = 0,
|
||||||
|
unsigned int index = 0);
|
||||||
|
|
||||||
|
aiReturn AddProperty (const aiUVTransform* pInput,
|
||||||
|
unsigned int pNumValues,
|
||||||
|
const char* pKey,
|
||||||
|
unsigned int type = 0,
|
||||||
|
unsigned int index = 0);
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
/** @brief Remove a given key from the list.
|
/** @brief Remove a given key from the list.
|
||||||
*
|
*
|
||||||
|
|
|
@ -89,7 +89,7 @@ inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
|
||||||
}
|
}
|
||||||
|
|
||||||
iNum = std::min((size_t)iNum,prop->mDataLength / sizeof(Type));
|
iNum = std::min((size_t)iNum,prop->mDataLength / sizeof(Type));
|
||||||
memcpy(pOut,prop->mData,iNum * sizeof(Type));
|
::memcpy(pOut,prop->mData,iNum * sizeof(Type));
|
||||||
if (pMax) {
|
if (pMax) {
|
||||||
*pMax = iNum;
|
*pMax = iNum;
|
||||||
}
|
}
|
||||||
|
@ -115,51 +115,45 @@ inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
|
||||||
return AI_FAILURE;
|
return AI_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&pOut,prop->mData,sizeof(Type));
|
::memcpy(&pOut,prop->mData,sizeof(Type));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template <>
|
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
|
||||||
inline aiReturn aiMaterial::Get<float>(const char* pKey,unsigned int type,
|
|
||||||
unsigned int idx,float* pOut,
|
unsigned int idx,float* pOut,
|
||||||
unsigned int* pMax) const
|
unsigned int* pMax) const
|
||||||
{
|
{
|
||||||
return ::aiGetMaterialFloatArray(this,pKey,type,idx,pOut,pMax);
|
return ::aiGetMaterialFloatArray(this,pKey,type,idx,pOut,pMax);
|
||||||
}
|
}
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template <>
|
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
|
||||||
inline aiReturn aiMaterial::Get<int>(const char* pKey,unsigned int type,
|
|
||||||
unsigned int idx,int* pOut,
|
unsigned int idx,int* pOut,
|
||||||
unsigned int* pMax) const
|
unsigned int* pMax) const
|
||||||
{
|
{
|
||||||
return ::aiGetMaterialIntegerArray(this,pKey,type,idx,pOut,pMax);
|
return ::aiGetMaterialIntegerArray(this,pKey,type,idx,pOut,pMax);
|
||||||
}
|
}
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template <>
|
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
|
||||||
inline aiReturn aiMaterial::Get<float>(const char* pKey,unsigned int type,
|
|
||||||
unsigned int idx,float& pOut) const
|
unsigned int idx,float& pOut) const
|
||||||
{
|
{
|
||||||
return aiGetMaterialFloat(this,pKey,type,idx,&pOut);
|
return aiGetMaterialFloat(this,pKey,type,idx,&pOut);
|
||||||
}
|
}
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template <>
|
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
|
||||||
inline aiReturn aiMaterial::Get<int>(const char* pKey,unsigned int type,
|
|
||||||
unsigned int idx,int& pOut) const
|
unsigned int idx,int& pOut) const
|
||||||
{
|
{
|
||||||
return aiGetMaterialInteger(this,pKey,type,idx,&pOut);
|
return aiGetMaterialInteger(this,pKey,type,idx,&pOut);
|
||||||
}
|
}
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template <>
|
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
|
||||||
inline aiReturn aiMaterial::Get<aiColor4D>(const char* pKey,unsigned int type,
|
|
||||||
unsigned int idx,aiColor4D& pOut) const
|
unsigned int idx,aiColor4D& pOut) const
|
||||||
{
|
{
|
||||||
return aiGetMaterialColor(this,pKey,type,idx,&pOut);
|
return aiGetMaterialColor(this,pKey,type,idx,&pOut);
|
||||||
}
|
}
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template <>
|
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
|
||||||
inline aiReturn aiMaterial::Get<aiColor3D>(const char* pKey,unsigned int type,
|
|
||||||
unsigned int idx,aiColor3D& pOut) const
|
unsigned int idx,aiColor3D& pOut) const
|
||||||
{
|
{
|
||||||
aiColor4D c;
|
aiColor4D c;
|
||||||
|
@ -168,8 +162,7 @@ inline aiReturn aiMaterial::Get<aiColor3D>(const char* pKey,unsigned int type,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template <>
|
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
|
||||||
inline aiReturn aiMaterial::Get<aiString>(const char* pKey,unsigned int type,
|
|
||||||
unsigned int idx,aiString& pOut) const
|
unsigned int idx,aiString& pOut) const
|
||||||
{
|
{
|
||||||
return aiGetMaterialString(this,pKey,type,idx,&pOut);
|
return aiGetMaterialString(this,pKey,type,idx,&pOut);
|
||||||
|
@ -190,8 +183,7 @@ aiReturn aiMaterial::AddProperty (const TYPE* pInput,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template<>
|
inline aiReturn aiMaterial::AddProperty(const float* pInput,
|
||||||
inline aiReturn aiMaterial::AddProperty<float> (const float* pInput,
|
|
||||||
const unsigned int pNumValues,
|
const unsigned int pNumValues,
|
||||||
const char* pKey,
|
const char* pKey,
|
||||||
unsigned int type,
|
unsigned int type,
|
||||||
|
@ -203,8 +195,7 @@ inline aiReturn aiMaterial::AddProperty<float> (const float* pInput,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template<>
|
inline aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput,
|
||||||
inline aiReturn aiMaterial::AddProperty<aiUVTransform> (const aiUVTransform* pInput,
|
|
||||||
const unsigned int pNumValues,
|
const unsigned int pNumValues,
|
||||||
const char* pKey,
|
const char* pKey,
|
||||||
unsigned int type,
|
unsigned int type,
|
||||||
|
@ -216,8 +207,7 @@ inline aiReturn aiMaterial::AddProperty<aiUVTransform> (const aiUVTransform* pIn
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template<>
|
inline aiReturn aiMaterial::AddProperty(const aiColor4D* pInput,
|
||||||
inline aiReturn aiMaterial::AddProperty<aiColor4D> (const aiColor4D* pInput,
|
|
||||||
const unsigned int pNumValues,
|
const unsigned int pNumValues,
|
||||||
const char* pKey,
|
const char* pKey,
|
||||||
unsigned int type,
|
unsigned int type,
|
||||||
|
@ -229,8 +219,7 @@ inline aiReturn aiMaterial::AddProperty<aiColor4D> (const aiColor4D* pInput,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template<>
|
inline aiReturn aiMaterial::AddProperty(const aiColor3D* pInput,
|
||||||
inline aiReturn aiMaterial::AddProperty<aiColor3D> (const aiColor3D* pInput,
|
|
||||||
const unsigned int pNumValues,
|
const unsigned int pNumValues,
|
||||||
const char* pKey,
|
const char* pKey,
|
||||||
unsigned int type,
|
unsigned int type,
|
||||||
|
@ -242,8 +231,7 @@ inline aiReturn aiMaterial::AddProperty<aiColor3D> (const aiColor3D* pInput,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template<>
|
inline aiReturn aiMaterial::AddProperty(const aiVector3D* pInput,
|
||||||
inline aiReturn aiMaterial::AddProperty<aiVector3D> (const aiVector3D* pInput,
|
|
||||||
const unsigned int pNumValues,
|
const unsigned int pNumValues,
|
||||||
const char* pKey,
|
const char* pKey,
|
||||||
unsigned int type,
|
unsigned int type,
|
||||||
|
@ -255,8 +243,7 @@ inline aiReturn aiMaterial::AddProperty<aiVector3D> (const aiVector3D* pInput,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
template<>
|
inline aiReturn aiMaterial::AddProperty(const int* pInput,
|
||||||
inline aiReturn aiMaterial::AddProperty<int> (const int* pInput,
|
|
||||||
const unsigned int pNumValues,
|
const unsigned int pNumValues,
|
||||||
const char* pKey,
|
const char* pKey,
|
||||||
unsigned int type,
|
unsigned int type,
|
||||||
|
|
Loading…
Reference in New Issue