mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add 'normal' vector attribute to 'tri' in vcm
This commit is contained in:
parent
21ad011e76
commit
fefdf096e7
1 changed files with 6 additions and 1 deletions
|
|
@ -223,7 +223,12 @@ static void perform_triangle(const xmlelement& root, ModelBuilder& builder) {
|
||||||
|
|
||||||
glm::vec3 ba = pointB - pointA;
|
glm::vec3 ba = pointB - pointA;
|
||||||
glm::vec3 ca = pointC - pointA;
|
glm::vec3 ca = pointC - pointA;
|
||||||
glm::vec3 normal = glm::normalize(glm::cross(ba, ca));
|
glm::vec3 normal;
|
||||||
|
if (root.has("normal")) {
|
||||||
|
normal = root.attr("normal").asVec3();
|
||||||
|
} else {
|
||||||
|
normal = glm::normalize(glm::cross(ba, ca));
|
||||||
|
}
|
||||||
|
|
||||||
if (root.has("uv")) {
|
if (root.has("uv")) {
|
||||||
root.attr("uv").asNumbers(glm::value_ptr(uvs[0]), 6);
|
root.attr("uv").asNumbers(glm::value_ptr(uvs[0]), 6);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue