mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 06:51:51 +00:00
fix vec3 shadeless flag
This commit is contained in:
parent
a78a924093
commit
5e05b44c26
1 changed files with 11 additions and 3 deletions
|
|
@ -23,6 +23,10 @@ enum AttributeType {
|
||||||
COLOR
|
COLOR
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MaterialFlag {
|
||||||
|
SHADELESS = 1
|
||||||
|
};
|
||||||
|
|
||||||
struct VertexAttribute {
|
struct VertexAttribute {
|
||||||
AttributeType type;
|
AttributeType type;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
@ -62,7 +66,7 @@ static VertexAttribute load_attribute(ByteReader& reader) {
|
||||||
static model::Mesh build_mesh(
|
static model::Mesh build_mesh(
|
||||||
const std::vector<VertexAttribute>& attrs,
|
const std::vector<VertexAttribute>& attrs,
|
||||||
const util::Buffer<uint16_t>& indices,
|
const util::Buffer<uint16_t>& indices,
|
||||||
const std::string& texture
|
const Material& material
|
||||||
) {
|
) {
|
||||||
const glm::vec3* coords = nullptr;
|
const glm::vec3* coords = nullptr;
|
||||||
const glm::vec2* uvs = nullptr;
|
const glm::vec2* uvs = nullptr;
|
||||||
|
|
@ -112,7 +116,11 @@ static model::Mesh build_mesh(
|
||||||
}
|
}
|
||||||
vertices.push_back(std::move(vertex));
|
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(
|
static model::Mesh load_mesh(
|
||||||
|
|
@ -154,7 +162,7 @@ static model::Mesh load_mesh(
|
||||||
return build_mesh(
|
return build_mesh(
|
||||||
attributes,
|
attributes,
|
||||||
indices,
|
indices,
|
||||||
materials.at(materialId).name
|
materials.at(materialId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue