parent
a443544986
commit
700954c115
|
@ -1406,30 +1406,25 @@ void FBXExporter::WriteObjects ()
|
|||
std::string path = it.first;
|
||||
// try get embedded texture
|
||||
const aiTexture* embedded_texture = mScene->GetEmbeddedTexture(it.first.c_str());
|
||||
if (embedded_texture != nullptr)
|
||||
{
|
||||
// change the path (use original filename, if available. If name is ampty, concatenate texture index with file extension)
|
||||
if (embedded_texture != nullptr) {
|
||||
// change the path (use original filename, if available. If name is empty, concatenate texture index with file extension)
|
||||
std::stringstream newPath;
|
||||
if (embedded_texture->mFilename.length > 0)
|
||||
if (embedded_texture->mFilename.length > 0) {
|
||||
newPath << embedded_texture->mFilename.C_Str();
|
||||
else if (embedded_texture->achFormatHint[0])
|
||||
{
|
||||
} else if (embedded_texture->achFormatHint[0]) {
|
||||
int texture_index = std::stoi(path.substr(1, path.size() - 1));
|
||||
newPath << texture_index << "." << embedded_texture->achFormatHint;
|
||||
}
|
||||
path = newPath.str();
|
||||
// embed the texture
|
||||
size_t texture_size = static_cast<size_t>(embedded_texture->mWidth * std::max(embedded_texture->mHeight, 1u));
|
||||
if (binary)
|
||||
{
|
||||
if (binary) {
|
||||
// embed texture as binary data
|
||||
std::vector<uint8_t> tex_data;
|
||||
tex_data.resize(texture_size);
|
||||
memcpy(&tex_data[0], (char*)embedded_texture->pcData, texture_size);
|
||||
n.AddChild("Content", tex_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// embed texture in base64 encoding
|
||||
std::string encoded_texture = FBX::Util::EncodeBase64((char*)embedded_texture->pcData, texture_size);
|
||||
n.AddChild("Content", encoded_texture);
|
||||
|
|
Loading…
Reference in New Issue