Fix compiler warnings related to issue 957.
This commit is contained in:
@@ -168,8 +168,7 @@ void addFacesToMesh(aiMesh* pMesh)
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file into the given scene structure.
|
||||
void STLImporter::InternReadFile( const std::string& pFile,
|
||||
aiScene* pScene, IOSystem* pIOHandler)
|
||||
void STLImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler )
|
||||
{
|
||||
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||
|
||||
@@ -189,7 +188,7 @@ void STLImporter::InternReadFile( const std::string& pFile,
|
||||
this->mBuffer = &mBuffer2[0];
|
||||
|
||||
// the default vertex color is light gray.
|
||||
clrColorDefault.r = clrColorDefault.g = clrColorDefault.b = clrColorDefault.a = 0.6;
|
||||
clrColorDefault.r = clrColorDefault.g = clrColorDefault.b = clrColorDefault.a = (ai_real) 0.6;
|
||||
|
||||
// allocate a single node
|
||||
pScene->mRootNode = new aiNode();
|
||||
@@ -217,13 +216,13 @@ void STLImporter::InternReadFile( const std::string& pFile,
|
||||
s.Set(AI_DEFAULT_MATERIAL_NAME);
|
||||
pcMat->AddProperty(&s, AI_MATKEY_NAME);
|
||||
|
||||
aiColor4D clrDiffuse(0.6,0.6,0.6,1.0);
|
||||
aiColor4D clrDiffuse(ai_real(0.6),ai_real(0.6),ai_real(0.6),ai_real(1.0));
|
||||
if (bMatClr) {
|
||||
clrDiffuse = clrColorDefault;
|
||||
}
|
||||
pcMat->AddProperty(&clrDiffuse,1,AI_MATKEY_COLOR_DIFFUSE);
|
||||
pcMat->AddProperty(&clrDiffuse,1,AI_MATKEY_COLOR_SPECULAR);
|
||||
clrDiffuse = aiColor4D(0.05,0.05,0.05,1.0);
|
||||
clrDiffuse = aiColor4D( ai_real( 0.05), ai_real( 0.05), ai_real( 0.05), ai_real( 1.0));
|
||||
pcMat->AddProperty(&clrDiffuse,1,AI_MATKEY_COLOR_AMBIENT);
|
||||
|
||||
pScene->mNumMaterials = 1;
|
||||
@@ -416,10 +415,11 @@ bool STLImporter::LoadBinaryFile()
|
||||
// read the default vertex color for facets
|
||||
bIsMaterialise = true;
|
||||
DefaultLogger::get()->info("STL: Taking code path for Materialise files");
|
||||
clrColorDefault.r = (*sz2++) / 255.0;
|
||||
clrColorDefault.g = (*sz2++) / 255.0;
|
||||
clrColorDefault.b = (*sz2++) / 255.0;
|
||||
clrColorDefault.a = (*sz2++) / 255.0;
|
||||
const ai_real invByte = (ai_real)1.0 / ( ai_real )255.0;
|
||||
clrColorDefault.r = (*sz2++) * invByte;
|
||||
clrColorDefault.g = (*sz2++) * invByte;
|
||||
clrColorDefault.b = (*sz2++) * invByte;
|
||||
clrColorDefault.a = (*sz2++) * invByte;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -481,17 +481,18 @@ bool STLImporter::LoadBinaryFile()
|
||||
}
|
||||
aiColor4D* clr = &pMesh->mColors[0][i*3];
|
||||
clr->a = 1.0;
|
||||
const ai_real invVal( (ai_real)1.0 / ( ai_real )31.0 );
|
||||
if (bIsMaterialise) // this is reversed
|
||||
{
|
||||
clr->r = (color & 0x31u) / 31.0;
|
||||
clr->g = ((color & (0x31u<<5))>>5u) / 31.0;
|
||||
clr->b = ((color & (0x31u<<10))>>10u) / 31.0;
|
||||
clr->r = (color & 0x31u) *invVal;
|
||||
clr->g = ((color & (0x31u<<5))>>5u) *invVal;
|
||||
clr->b = ((color & (0x31u<<10))>>10u) *invVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
clr->b = (color & 0x31u) / 31.0;
|
||||
clr->g = ((color & (0x31u<<5))>>5u) / 31.0;
|
||||
clr->r = ((color & (0x31u<<10))>>10u) / 31.0;
|
||||
clr->b = (color & 0x31u) *invVal;
|
||||
clr->g = ((color & (0x31u<<5))>>5u) *invVal;
|
||||
clr->r = ((color & (0x31u<<10))>>10u) *invVal;
|
||||
}
|
||||
// assign the color to all vertices of the face
|
||||
*(clr+1) = *clr;
|
||||
|
||||
Reference in New Issue
Block a user