Fix review findings.
parent
82e213fb7c
commit
5289954e27
|
@ -239,7 +239,6 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${C
|
||||||
|
|
||||||
FIND_PACKAGE( DirectX )
|
FIND_PACKAGE( DirectX )
|
||||||
|
|
||||||
|
|
||||||
IF( BUILD_DOCS )
|
IF( BUILD_DOCS )
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
ENDIF( BUILD_DOCS )
|
ENDIF( BUILD_DOCS )
|
||||||
|
|
|
@ -42,9 +42,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* @brief Implementation of conversion routines to convert IFC materials to aiMaterial
|
* @brief Implementation of conversion routines to convert IFC materials to aiMaterial
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
|
||||||
|
|
||||||
#include "IFCUtil.h"
|
#include "IFCUtil.h"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
@ -53,8 +52,7 @@ namespace Assimp {
|
||||||
namespace IFC {
|
namespace IFC {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
int ConvertShadingMode(const std::string& name)
|
static int ConvertShadingMode(const std::string& name) {
|
||||||
{
|
|
||||||
if (name == "BLINN") {
|
if (name == "BLINN") {
|
||||||
return aiShadingMode_Blinn;
|
return aiShadingMode_Blinn;
|
||||||
}
|
}
|
||||||
|
@ -69,8 +67,7 @@ int ConvertShadingMode(const std::string& name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,ConversionData& conv)
|
static 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"));
|
||||||
mat->AddProperty(&name,AI_MATKEY_NAME);
|
mat->AddProperty(&name,AI_MATKEY_NAME);
|
||||||
|
@ -134,8 +131,7 @@ void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,ConversionDat
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionData& conv, bool forceDefaultMat)
|
unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionData& conv, bool forceDefaultMat) {
|
||||||
{
|
|
||||||
STEP::DB::RefMapRange range = conv.db.GetRefs().equal_range(id);
|
STEP::DB::RefMapRange range = conv.db.GetRefs().equal_range(id);
|
||||||
for(;range.first != range.second; ++range.first) {
|
for(;range.first != range.second; ++range.first) {
|
||||||
if(const IFC::IfcStyledItem* const styled = conv.db.GetObject((*range.first).second)->ToPtr<IFC::IfcStyledItem>()) {
|
if(const IFC::IfcStyledItem* const styled = conv.db.GetObject((*range.first).second)->ToPtr<IFC::IfcStyledItem>()) {
|
||||||
|
@ -169,25 +165,27 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat
|
||||||
}
|
}
|
||||||
|
|
||||||
// no local material defined. If there's global one, use that instead
|
// no local material defined. If there's global one, use that instead
|
||||||
if( prevMatId != std::numeric_limits<uint32_t>::max() )
|
if ( prevMatId != std::numeric_limits<uint32_t>::max() ) {
|
||||||
return prevMatId;
|
return prevMatId;
|
||||||
|
}
|
||||||
|
|
||||||
// we're still here - create an default material if required, or simply fail otherwise
|
// we're still here - create an default material if required, or simply fail otherwise
|
||||||
if( !forceDefaultMat )
|
if ( !forceDefaultMat ) {
|
||||||
return std::numeric_limits<uint32_t>::max();
|
return std::numeric_limits<uint32_t>::max();
|
||||||
|
}
|
||||||
|
|
||||||
aiString name;
|
aiString name;
|
||||||
name.Set("<IFCDefault>");
|
name.Set("<IFCDefault>");
|
||||||
// ConvertColorToString( color, name);
|
// ConvertColorToString( color, name);
|
||||||
|
|
||||||
// look if there's already a default material with this base color
|
// look if there's already a default material with this base color
|
||||||
for( size_t a = 0; a < conv.materials.size(); ++a )
|
for( size_t a = 0; a < conv.materials.size(); ++a ) {
|
||||||
{
|
|
||||||
aiString mname;
|
aiString mname;
|
||||||
conv.materials[a]->Get(AI_MATKEY_NAME, mname);
|
conv.materials[a]->Get(AI_MATKEY_NAME, mname);
|
||||||
if( name == mname )
|
if ( name == mname ) {
|
||||||
return ( unsigned int )a;
|
return ( unsigned int )a;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// we're here, yet - no default material with suitable color available. Generate one
|
// we're here, yet - no default material with suitable color available. Generate one
|
||||||
std::unique_ptr<aiMaterial> mat(new aiMaterial());
|
std::unique_ptr<aiMaterial> mat(new aiMaterial());
|
||||||
|
@ -203,4 +201,4 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat
|
||||||
} // ! IFC
|
} // ! IFC
|
||||||
} // ! Assimp
|
} // ! Assimp
|
||||||
|
|
||||||
#endif
|
#endif // ASSIMP_BUILD_NO_IFC_IMPORTER
|
||||||
|
|
Loading…
Reference in New Issue