Support material texture in gltf parser
This commit is contained in:
parent
98300b2f64
commit
d68242d59d
2 changed files with 6 additions and 0 deletions
|
|
@ -48,6 +48,7 @@ namespace psemek::gfx
|
|||
std::optional<color_4f> albedo;
|
||||
std::optional<std::size_t> texture;
|
||||
std::optional<color_3f> emission;
|
||||
std::optional<std::size_t> material_texture;
|
||||
};
|
||||
|
||||
struct texture
|
||||
|
|
|
|||
|
|
@ -170,6 +170,11 @@ namespace psemek::gfx
|
|||
target.texture = document["textures"].GetArray()[pbr["baseColorTexture"]["index"].GetUint64()]["source"].GetInt64();
|
||||
}
|
||||
|
||||
if (pbr.HasMember("metallicRoughnessTexture"))
|
||||
{
|
||||
target.material_texture = document["textures"].GetArray()[pbr["metallicRoughnessTexture"]["index"].GetUint64()]["source"].GetInt64();
|
||||
}
|
||||
|
||||
if (material.HasMember("emissiveFactor"))
|
||||
{
|
||||
auto const & emission = material["emissiveFactor"].GetArray();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue