Skip to content

Commit

Permalink
model importer - fix color import
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Dec 14, 2024
1 parent a0813cb commit 9d957a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/renderer/editor/fbx_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ struct FBXImporter : ModelImporter {
mat_idx = materials.size();
ImportMaterial& mat = m_materials.emplace(m_allocator);
const ofbx::Color diffuse_color = fbx_mat->getDiffuseColor();
mat.diffuse_color = { diffuse_color.r, diffuse_color.g, diffuse_color.b };
mat.diffuse_color = { powf(diffuse_color.r, 2.2f), powf(diffuse_color.g, 2.2f), powf(diffuse_color.b, 2.2f) };
materials.push(fbx_mat);
}

Expand Down Expand Up @@ -1235,6 +1235,7 @@ struct FBXImporter : ModelImporter {
mat.name = name;
}

// TODO move this to modelimporter?
// gather textures
// we don't support dds, but try it as last option, so user can get error message with filepath
const char* exts[] = { "png", "jpg", "jpeg", "tga", "bmp", "dds" };
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/editor/model_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,9 @@ bool ModelImporter::writeMaterials(const Path& src, const ModelMeta& meta, bool

if (!material.textures[0].import && !meta.ignore_material_colors) {
const Vec3 color = material.diffuse_color;
blob << "uniform \"Material color\", {" << powf(color.x, 2.2f)
<< "," << powf(color.x, 2.2f)
<< "," << powf(color.z, 2.2f)
blob << "uniform \"Material color\", {" << color.x
<< "," << color.y
<< "," << color.z
<< ",1}\n";
}

Expand Down

0 comments on commit 9d957a9

Please sign in to comment.