mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2024-11-27 02:24:04 -05:00
Merge pull request #120 from AnalyticalGraphicsInc/loading-fix
Don't add a face that contains only two vertices
This commit is contained in:
commit
09271d284a
@ -329,7 +329,7 @@ function loadObj(objPath, options) {
|
||||
function isConvex(positions2D) {
|
||||
var turnDirection = getTurnDirection(positions2D[0], positions2D[1], positions2D[2]);
|
||||
for (var i=1; i < positions2D.length-2; ++i) {
|
||||
var currentTurnDirection = getTurnDirection(positions2D[i], positions2D[i+1], positions2D[i+2]);
|
||||
var currentTurnDirection = getTurnDirection(positions2D[i], positions2D[i+1], positions2D[i+2]);
|
||||
if (turnDirection * currentTurnDirection < 0) {
|
||||
return false;
|
||||
}
|
||||
@ -465,7 +465,9 @@ function loadObj(objPath, options) {
|
||||
faceUvs.push(result[2]);
|
||||
faceNormals.push(result[3]);
|
||||
}
|
||||
addFace(faceVertices, facePositions, faceUvs, faceNormals);
|
||||
if (faceVertices.length > 2) {
|
||||
addFace(faceVertices, facePositions, faceUvs, faceNormals);
|
||||
}
|
||||
|
||||
faceVertices.length = 0;
|
||||
facePositions.length = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user