Merge branch 'master' into kimkulling-net-doc

pull/1989/head
Kim Kulling 2018-06-03 00:54:56 +02:00 committed by GitHub
commit d112095a83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 13 deletions

View File

@ -204,8 +204,9 @@ void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type)
mat.AddProperty<ai_real>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0)); mat.AddProperty<ai_real>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0));
// Setup the texture mapping mode // Setup the texture mapping mode
mat.AddProperty<int>((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_U(type,0)); int mapMode = static_cast<int>(texture.mMapMode);
mat.AddProperty<int>((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_V(type,0)); mat.AddProperty<int>(&mapMode,1,AI_MATKEY_MAPPINGMODE_U(type,0));
mat.AddProperty<int>(&mapMode,1,AI_MATKEY_MAPPINGMODE_V(type,0));
// Mirroring - double the scaling values // Mirroring - double the scaling values
// FIXME: this is not really correct ... // FIXME: this is not really correct ...
@ -313,7 +314,8 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material& oldMat,
case D3DS::Discreet3DS::Blinn : case D3DS::Discreet3DS::Blinn :
eShading = aiShadingMode_Blinn; break; eShading = aiShadingMode_Blinn; break;
} }
mat.AddProperty<int>( (int*)&eShading,1,AI_MATKEY_SHADING_MODEL); int eShading_ = static_cast<int>(eShading);
mat.AddProperty<int>(&eShading_, 1, AI_MATKEY_SHADING_MODEL);
// DIFFUSE texture // DIFFUSE texture
if( oldMat.sTexDiffuse.mMapName.length() > 0) if( oldMat.sTexDiffuse.mMapName.length() > 0)

View File

@ -253,7 +253,8 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
pcMat->AddProperty<int>((int*)&temp,1,AI_MATKEY_TEXOP(type,cur)); pcMat->AddProperty<int>((int*)&temp,1,AI_MATKEY_TEXOP(type,cur));
// setup the mapping mode // setup the mapping mode
pcMat->AddProperty<int>((int*)&mapping,1,AI_MATKEY_MAPPING(type,cur)); int mapping_ = static_cast<int>(mapping);
pcMat->AddProperty<int>(&mapping_, 1, AI_MATKEY_MAPPING(type, cur));
// add the u-wrapping // add the u-wrapping
temp = (unsigned int)GetMapMode(texture.wrapModeWidth); temp = (unsigned int)GetMapMode(texture.wrapModeWidth);
@ -365,7 +366,8 @@ void LWOImporter::ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat)
} }
if (surf.mMaximumSmoothAngle <= 0.0) if (surf.mMaximumSmoothAngle <= 0.0)
m = aiShadingMode_Flat; m = aiShadingMode_Flat;
pcMat->AddProperty((int*)&m,1,AI_MATKEY_SHADING_MODEL); int m_ = static_cast<int>(m);
pcMat->AddProperty(&m_, 1, AI_MATKEY_SHADING_MODEL);
// (the diffuse value is just a scaling factor) // (the diffuse value is just a scaling factor)
// If a diffuse texture is set, we set this value to 1.0 // If a diffuse texture is set, we set this value to 1.0

View File

@ -354,8 +354,9 @@ aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
return AI_FAILURE; return AI_FAILURE;
} }
// Determine mapping type // Determine mapping type
aiTextureMapping mapping = aiTextureMapping_UV; int mapping_ = static_cast<int>(aiTextureMapping_UV);
aiGetMaterialInteger(mat,AI_MATKEY_MAPPING(type,index),(int*)&mapping); aiGetMaterialInteger(mat,AI_MATKEY_MAPPING(type,index), &mapping_);
aiTextureMapping mapping = static_cast<aiTextureMapping>(mapping_);
if (_mapping) if (_mapping)
*_mapping = mapping; *_mapping = mapping;

View File

@ -98,8 +98,10 @@ AI_FORCE_INLINE bool is_qnan(float in)
// compare <register-with-different-width> against <in> // compare <register-with-different-width> against <in>
// FIXME: Use <float> stuff instead? I think fpclassify needs C99 // FIXME: Use <float> stuff instead? I think fpclassify needs C99
return (reinterpret_cast<_IEEESingle*>(&in)->IEEE.Exp == (1u << 8)-1 && _IEEESingle temp;
reinterpret_cast<_IEEESingle*>(&in)->IEEE.Frac); memcpy(&temp, &in, sizeof(float));
return (temp.IEEE.Exp == (1u << 8)-1 &&
temp.IEEE.Frac);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -114,8 +116,10 @@ AI_FORCE_INLINE bool is_qnan(double in)
// compare <register-with-different-width> against <in> // compare <register-with-different-width> against <in>
// FIXME: Use <float> stuff instead? I think fpclassify needs C99 // FIXME: Use <float> stuff instead? I think fpclassify needs C99
return (reinterpret_cast<_IEEEDouble*>(&in)->IEEE.Exp == (1u << 11)-1 && _IEEEDouble temp;
reinterpret_cast<_IEEEDouble*>(&in)->IEEE.Frac); memcpy(&temp, &in, sizeof(in));
return (temp.IEEE.Exp == (1u << 11)-1 &&
temp.IEEE.Frac);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -125,7 +129,9 @@ AI_FORCE_INLINE bool is_qnan(double in)
* @param in Input value */ * @param in Input value */
AI_FORCE_INLINE bool is_special_float(float in) AI_FORCE_INLINE bool is_special_float(float in)
{ {
return (reinterpret_cast<_IEEESingle*>(&in)->IEEE.Exp == (1u << 8)-1); _IEEESingle temp;
memcpy(&temp, &in, sizeof(float));
return (temp.IEEE.Exp == (1u << 8)-1);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -135,7 +141,9 @@ AI_FORCE_INLINE bool is_special_float(float in)
* @param in Input value */ * @param in Input value */
AI_FORCE_INLINE bool is_special_float(double in) AI_FORCE_INLINE bool is_special_float(double in)
{ {
return (reinterpret_cast<_IEEEDouble*>(&in)->IEEE.Exp == (1u << 11)-1); _IEEESingle temp;
memcpy(&temp, &in, sizeof(float));
return (temp.IEEE.Exp == (1u << 11)-1);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------