mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add src/coders/obj
This commit is contained in:
parent
a9640fff36
commit
e4f9bd03b7
11 changed files with 241 additions and 28 deletions
|
|
@ -66,13 +66,19 @@ void ModelBatch::draw(const model::Model& model) {
|
|||
} else {
|
||||
blank->bind();
|
||||
}
|
||||
for (const auto& vert : mesh.vertices) {
|
||||
auto norm = rotation * vert.normal;
|
||||
float d = glm::dot(norm, SUN_VECTOR);
|
||||
d = 0.8f + d * 0.2f;
|
||||
|
||||
auto color = lights * d;
|
||||
vertex(vert.coord, vert.uv, color);
|
||||
for (size_t i = 0; i < mesh.vertices.size() / 3; i++) {
|
||||
if (index + VERTEX_SIZE * 3 > capacity) {
|
||||
flush();
|
||||
}
|
||||
for (size_t j = 0; j < 3; j++) {
|
||||
const auto& vert = mesh.vertices[i * 3 + j];
|
||||
auto norm = rotation * vert.normal;
|
||||
float d = glm::dot(norm, SUN_VECTOR);
|
||||
d = 0.8f + d * 0.2f;
|
||||
|
||||
auto color = lights * d;
|
||||
vertex(vert.coord, vert.uv, color);
|
||||
}
|
||||
}
|
||||
flush();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue