Correct line processing.
This commit is contained in:
parent
040ef5aa77
commit
0319fd4b32
@ -394,7 +394,8 @@ export class ImporterObj extends ImporterBase
|
||||
|
||||
let vertices = [];
|
||||
for (let i = 0; i < parameters.length; i++) {
|
||||
let vertexIndex = this.GetRelativeIndex (parseInt (parameters[i], 10), this.globalVertices.length);
|
||||
let vertexParams = parameters[i].split ('/');
|
||||
let vertexIndex = this.GetRelativeIndex (parseInt (vertexParams[0], 10), this.globalVertices.length);
|
||||
let meshVertexIndex = this.currentMeshConverter.AddVertex (vertexIndex, this.globalVertices);
|
||||
if (meshVertexIndex === null) {
|
||||
this.SetError ('Invalid vertex index.');
|
||||
|
||||
11
test/testfiles/obj/lines_with_vt.obj
Normal file
11
test/testfiles/obj/lines_with_vt.obj
Normal file
@ -0,0 +1,11 @@
|
||||
v 0.0 0.0 0.0
|
||||
v 1.0 0.0 0.0
|
||||
v 1.0 1.0 0.0
|
||||
v 0.0 1.0 0.0
|
||||
v 0.0 0.0 1.0
|
||||
v 1.0 0.0 1.0
|
||||
v 1.0 1.0 1.0
|
||||
v 0.0 1.0 1.0
|
||||
l 1/1 2/2
|
||||
l 3/3 4/4
|
||||
l 5/5 6/6 7/7 8/8 5/5
|
||||
@ -685,6 +685,39 @@ describe ('Obj Importer', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it ('lines_with_vt.obj', function (done) {
|
||||
ImportObjFile ('lines_with_vt.obj', function (model) {
|
||||
assert.ok (OV.CheckModel (model));
|
||||
assert.deepStrictEqual (ModelToObject (model), {
|
||||
name : '',
|
||||
materials : [
|
||||
{ name : '' }
|
||||
],
|
||||
meshes : [
|
||||
{
|
||||
name : '',
|
||||
lines : [
|
||||
{
|
||||
vertices : [0, 0, 0, 1, 0, 0],
|
||||
mat : 0
|
||||
},
|
||||
{
|
||||
vertices : [1, 1, 0, 0, 1, 0],
|
||||
mat : 0
|
||||
},
|
||||
{
|
||||
vertices : [0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1],
|
||||
mat : 0
|
||||
}
|
||||
],
|
||||
triangles : []
|
||||
}
|
||||
]
|
||||
});
|
||||
done ();
|
||||
});
|
||||
});
|
||||
|
||||
it ('lines_in_meshes.obj', function (done) {
|
||||
ImportObjFile ('lines_in_meshes.obj', function (model) {
|
||||
assert.ok (OV.CheckModel (model));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user