From 2ed3222bbe16a128145251aaae5478392272e013 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Fri, 12 Aug 2016 18:58:34 +0900 Subject: [PATCH 1/2] Compute geometric normal where vertex normal is not available. --- experimental/viewer.cc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/experimental/viewer.cc b/experimental/viewer.cc index d4c9d29..5c9cc49 100644 --- a/experimental/viewer.cc +++ b/experimental/viewer.cc @@ -271,16 +271,21 @@ bool LoadObjAndConvert(float bmin[3], float bmax[3], const char* filename, int n int f0 = idx0.vn_idx; int f1 = idx1.vn_idx; int f2 = idx2.vn_idx; - assert(f0 >= 0); - assert(f1 >= 0); - assert(f2 >= 0); - assert(3*f0+2 < attrib.normals.size()); - assert(3*f1+2 < attrib.normals.size()); - assert(3*f2+2 < attrib.normals.size()); - for (int k = 0; k < 3; k++) { - n[0][k] = attrib.normals[3*f0+k]; - n[1][k] = attrib.normals[3*f1+k]; - n[2][k] = attrib.normals[3*f2+k]; + + if (f0 >= 0 && f1 >= 0 && f2 >= 0) { + assert(3*f0+2 < attrib.normals.size()); + assert(3*f1+2 < attrib.normals.size()); + assert(3*f2+2 < attrib.normals.size()); + for (int k = 0; k < 3; k++) { + n[0][k] = attrib.normals[3*f0+k]; + n[1][k] = attrib.normals[3*f1+k]; + n[2][k] = attrib.normals[3*f2+k]; + } + } else { + // compute geometric normal + CalcNormal(n[0], v[0], v[1], v[2]); + n[1][0] = n[0][0]; n[1][1] = n[0][1]; n[1][2] = n[0][2]; + n[2][0] = n[0][0]; n[2][1] = n[0][1]; n[2][2] = n[0][2]; } } else { // compute geometric normal From b56fc1a0cc1c86a62d2825a67156ec7f024e6649 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Fri, 12 Aug 2016 19:01:51 +0900 Subject: [PATCH 2/2] Fix appveyor script. --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4df02f3..9430b49 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,6 @@ install: # All external dependencies are installed in C:\projects\deps ####################################################################################### - mkdir C:\projects\deps - - pushd C:\projects\deps ####################################################################################### # Install Ninja @@ -17,7 +16,6 @@ install: - 7z x ninja.zip -oC:\projects\deps\ninja > nul - set PATH=C:\projects\deps\ninja;%PATH% - ninja --version - - popd build_script: - cd tests