FBX: LayeredTextures now work with embedded texture data
parent
dd0d602681
commit
ffb6756d2a
|
@ -1526,17 +1526,7 @@ unsigned int Converter::ConvertVideo( const Video& video )
|
||||||
return static_cast<unsigned int>( textures.size() - 1 );
|
return static_cast<unsigned int>( textures.size() - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap& textures,
|
aiString Converter::GetTexturePath(const Texture* tex)
|
||||||
const std::string& propName,
|
|
||||||
aiTextureType target, const MeshGeometry* const mesh )
|
|
||||||
{
|
|
||||||
TextureMap::const_iterator it = textures.find( propName );
|
|
||||||
if ( it == textures.end() ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Texture* const tex = ( *it ).second;
|
|
||||||
if ( tex != 0 )
|
|
||||||
{
|
{
|
||||||
aiString path;
|
aiString path;
|
||||||
path.Set(tex->RelativeFilename());
|
path.Set(tex->RelativeFilename());
|
||||||
|
@ -1573,6 +1563,22 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap& textures,
|
||||||
|
const std::string& propName,
|
||||||
|
aiTextureType target, const MeshGeometry* const mesh )
|
||||||
|
{
|
||||||
|
TextureMap::const_iterator it = textures.find( propName );
|
||||||
|
if ( it == textures.end() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Texture* const tex = ( *it ).second;
|
||||||
|
if ( tex != 0 )
|
||||||
|
{
|
||||||
|
aiString path = GetTexturePath(tex);
|
||||||
out_mat->AddProperty( &path, _AI_MATKEY_TEXTURE_BASE, target, 0 );
|
out_mat->AddProperty( &path, _AI_MATKEY_TEXTURE_BASE, target, 0 );
|
||||||
|
|
||||||
aiUVTransform uvTrafo;
|
aiUVTransform uvTrafo;
|
||||||
|
@ -1696,9 +1702,7 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextu
|
||||||
|
|
||||||
const Texture* const tex = ( *it ).second->getTexture(texIndex);
|
const Texture* const tex = ( *it ).second->getTexture(texIndex);
|
||||||
|
|
||||||
aiString path;
|
aiString path = GetTexturePath(tex);
|
||||||
path.Set( tex->RelativeFilename() );
|
|
||||||
|
|
||||||
out_mat->AddProperty( &path, _AI_MATKEY_TEXTURE_BASE, target, texIndex );
|
out_mat->AddProperty( &path, _AI_MATKEY_TEXTURE_BASE, target, texIndex );
|
||||||
|
|
||||||
aiUVTransform uvTrafo;
|
aiUVTransform uvTrafo;
|
||||||
|
|
|
@ -228,6 +228,10 @@ private:
|
||||||
// Video -> aiTexture
|
// Video -> aiTexture
|
||||||
unsigned int ConvertVideo(const Video& video);
|
unsigned int ConvertVideo(const Video& video);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
// convert embedded texture if necessary and return actual texture path
|
||||||
|
aiString GetTexturePath(const Texture* tex);
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void TrySetTextureProperties(aiMaterial* out_mat, const TextureMap& textures,
|
void TrySetTextureProperties(aiMaterial* out_mat, const TextureMap& textures,
|
||||||
const std::string& propName,
|
const std::string& propName,
|
||||||
|
|
Loading…
Reference in New Issue