Merge commit '87a0e7703258576f1a7e4ba763b961da70c1cd91' into contrib

Conflicts:
	code/ColladaExporter.cpp
This commit is contained in:
Léo Terziman
2014-01-17 11:19:29 +01:00
37 changed files with 1716 additions and 1197 deletions
+7 -1
View File
@@ -198,7 +198,13 @@ public:
* redundant as exporters would apply them anyhow. A good example
* is triangulation - whilst you can enforce it by specifying
* the #aiProcess_Triangulate flag, most export formats support only
* triangulate data so they would run the step even if it wasn't requested.
* triangulate data so they would run the step even if it wasn't requested.
*
* If assimp detects that the input scene was directly taken from the importer side of
* the library (i.e. not copied using aiCopyScene and potetially modified afterwards),
* any postprocessing steps already applied to the scene will not be applied again, unless
* they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and
* #aiProcess_FlipWindingOrder).
* @return AI_SUCCESS if everything was fine.
* @note Use aiCopyScene() to get a modifiable copy of a previously
* imported scene.*/
+6
View File
@@ -143,6 +143,12 @@ ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn);
* is triangulation - whilst you can enforce it by specifying
* the #aiProcess_Triangulate flag, most export formats support only
* triangulate data so they would run the step anyway.
*
* If assimp detects that the input scene was directly taken from the importer side of
* the library (i.e. not copied using aiCopyScene and potetially modified afterwards),
* any postprocessing steps already applied to the scene will not be applied again, unless
* they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and
* #aiProcess_FlipWindingOrder).
* @return a status code indicating the result of the export
* @note Use aiCopyScene() to get a modifiable copy of a previously
* imported scene.
+61
View File
@@ -691,6 +691,12 @@ public:
aiReturn Get(const char* pKey,unsigned int type,
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
* from the material
@@ -705,6 +711,25 @@ public:
aiReturn Get(const char* pKey,unsigned int type,
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.
* @param type Texture type to check for
@@ -797,6 +822,42 @@ public:
unsigned int type = 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.
*
+94 -22
View File
@@ -89,7 +89,7 @@ inline aiReturn aiMaterial::Get(const char* pKey,unsigned int 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) {
*pMax = iNum;
}
@@ -115,51 +115,45 @@ inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
return AI_FAILURE;
}
memcpy(&pOut,prop->mData,sizeof(Type));
::memcpy(&pOut,prop->mData,sizeof(Type));
}
return ret;
}
// ---------------------------------------------------------------------------
template <>
inline aiReturn aiMaterial::Get<float>(const char* pKey,unsigned int type,
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
unsigned int idx,float* pOut,
unsigned int* pMax) const
{
return ::aiGetMaterialFloatArray(this,pKey,type,idx,pOut,pMax);
}
// ---------------------------------------------------------------------------
template <>
inline aiReturn aiMaterial::Get<int>(const char* pKey,unsigned int type,
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
unsigned int idx,int* pOut,
unsigned int* pMax) const
{
return ::aiGetMaterialIntegerArray(this,pKey,type,idx,pOut,pMax);
}
// ---------------------------------------------------------------------------
template <>
inline aiReturn aiMaterial::Get<float>(const char* pKey,unsigned int type,
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
unsigned int idx,float& pOut) const
{
return aiGetMaterialFloat(this,pKey,type,idx,&pOut);
}
// ---------------------------------------------------------------------------
template <>
inline aiReturn aiMaterial::Get<int>(const char* pKey,unsigned int type,
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
unsigned int idx,int& pOut) const
{
return aiGetMaterialInteger(this,pKey,type,idx,&pOut);
}
// ---------------------------------------------------------------------------
template <>
inline aiReturn aiMaterial::Get<aiColor4D>(const char* pKey,unsigned int type,
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
unsigned int idx,aiColor4D& pOut) const
{
return aiGetMaterialColor(this,pKey,type,idx,&pOut);
}
// ---------------------------------------------------------------------------
template <>
inline aiReturn aiMaterial::Get<aiColor3D>(const char* pKey,unsigned int type,
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
unsigned int idx,aiColor3D& pOut) const
{
aiColor4D c;
@@ -168,8 +162,7 @@ inline aiReturn aiMaterial::Get<aiColor3D>(const char* pKey,unsigned int type,
return ret;
}
// ---------------------------------------------------------------------------
template <>
inline aiReturn aiMaterial::Get<aiString>(const char* pKey,unsigned int type,
inline aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
unsigned int idx,aiString& pOut) const
{
return aiGetMaterialString(this,pKey,type,idx,&pOut);
@@ -189,9 +182,88 @@ aiReturn aiMaterial::AddProperty (const TYPE* pInput,
pKey,type,index,aiPTI_Buffer);
}
// ---------------------------------------------------------------------------
inline aiReturn aiMaterial::AddProperty(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);
}
// ---------------------------------------------------------------------------
inline aiReturn aiMaterial::AddProperty(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);
}
// ---------------------------------------------------------------------------
inline aiReturn aiMaterial::AddProperty(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);
}
// ---------------------------------------------------------------------------
inline aiReturn aiMaterial::AddProperty(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);
}
// ---------------------------------------------------------------------------
inline aiReturn aiMaterial::AddProperty(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);
}
// ---------------------------------------------------------------------------
inline aiReturn aiMaterial::AddProperty(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);
}
// ---------------------------------------------------------------------------
// The template specializations below are for backwards compatibility.
// The recommended way to add material properties is using the non-template
// overloads.
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
template<>
inline aiReturn aiMaterial::AddProperty<float> (const float* pInput,
inline aiReturn aiMaterial::AddProperty<float>(const float* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
@@ -204,7 +276,7 @@ inline aiReturn aiMaterial::AddProperty<float> (const float* pInput,
// ---------------------------------------------------------------------------
template<>
inline aiReturn aiMaterial::AddProperty<aiUVTransform> (const aiUVTransform* pInput,
inline aiReturn aiMaterial::AddProperty<aiUVTransform>(const aiUVTransform* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
@@ -217,7 +289,7 @@ inline aiReturn aiMaterial::AddProperty<aiUVTransform> (const aiUVTransform* pIn
// ---------------------------------------------------------------------------
template<>
inline aiReturn aiMaterial::AddProperty<aiColor4D> (const aiColor4D* pInput,
inline aiReturn aiMaterial::AddProperty<aiColor4D>(const aiColor4D* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
@@ -230,7 +302,7 @@ inline aiReturn aiMaterial::AddProperty<aiColor4D> (const aiColor4D* pInput,
// ---------------------------------------------------------------------------
template<>
inline aiReturn aiMaterial::AddProperty<aiColor3D> (const aiColor3D* pInput,
inline aiReturn aiMaterial::AddProperty<aiColor3D>(const aiColor3D* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
@@ -243,7 +315,7 @@ inline aiReturn aiMaterial::AddProperty<aiColor3D> (const aiColor3D* pInput,
// ---------------------------------------------------------------------------
template<>
inline aiReturn aiMaterial::AddProperty<aiVector3D> (const aiVector3D* pInput,
inline aiReturn aiMaterial::AddProperty<aiVector3D>(const aiVector3D* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,
@@ -256,7 +328,7 @@ inline aiReturn aiMaterial::AddProperty<aiVector3D> (const aiVector3D* pInput,
// ---------------------------------------------------------------------------
template<>
inline aiReturn aiMaterial::AddProperty<int> (const int* pInput,
inline aiReturn aiMaterial::AddProperty<int>(const int* pInput,
const unsigned int pNumValues,
const char* pKey,
unsigned int type,