Merge pull request #813 from clasher113/main

bug fix
This commit is contained in:
MihailRis 2026-03-16 21:45:59 +03:00 • committed by GitHub
commit 5502c2e7ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 75 additions and 35 deletions

View file

@ -23,6 +23,10 @@ enum AttributeType {
COLOR
};
enum MaterialFlag {
SHADELESS = 1
};
struct VertexAttribute {
AttributeType type;
int flags;
@ -62,7 +66,7 @@ static VertexAttribute load_attribute(ByteReader& reader) {
static model::Mesh build_mesh(
const std::vector<VertexAttribute>& attrs,
const util::Buffer<uint16_t>& indices,
const std::string& texture
const Material& material
) {
const glm::vec3* coords = nullptr;
const glm::vec2* uvs = nullptr;
@ -112,7 +116,11 @@ static model::Mesh build_mesh(
}
vertices.push_back(std::move(vertex));
}
return model::Mesh {texture, std::move(vertices)};
return model::Mesh {
material.name,
std::move(vertices),
(material.flags & MaterialFlag::SHADELESS) == 0
};
}
static model::Mesh load_mesh(
@ -154,7 +162,7 @@ static model::Mesh load_mesh(
return build_mesh(
attributes,
indices,
materials.at(materialId).name
materials.at(materialId)
);
}