Tests for vertex color count.

This commit is contained in:
kovacsv 2021-12-28 22:16:54 +01:00
parent 10f7df63bc
commit 7603537142
7 changed files with 139 additions and 30 deletions

View File

@ -19,6 +19,7 @@ describe ('3ds Importer', function() {
{
name : 'cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 8,
triangleCount : 12,
@ -49,6 +50,7 @@ describe ('3ds Importer', function() {
{
name : 'cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 8,
triangleCount : 12,
@ -79,6 +81,7 @@ describe ('3ds Importer', function() {
{
name : 'cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 8,
triangleCount : 12,
@ -90,6 +93,7 @@ describe ('3ds Importer', function() {
{
name : 'cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 8,
triangleCount : 12,
@ -120,6 +124,7 @@ describe ('3ds Importer', function() {
{
name : 'cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 8,
triangleCount : 12,
@ -131,6 +136,7 @@ describe ('3ds Importer', function() {
{
name : 'cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 8,
triangleCount : 12,
@ -142,6 +148,7 @@ describe ('3ds Importer', function() {
{
name : 'cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 8,
triangleCount : 12,
@ -153,6 +160,7 @@ describe ('3ds Importer', function() {
{
name : 'cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 8,
triangleCount : 12,
@ -177,6 +185,7 @@ describe ('3ds Importer', function() {
{
name: 'Cube',
vertexCount: 8,
vertexColorCount: 0,
normalCount: 12,
uvCount: 8,
triangleCount: 12,
@ -185,6 +194,7 @@ describe ('3ds Importer', function() {
{
name: 'Cube',
vertexCount: 8,
vertexColorCount: 0,
normalCount: 12,
uvCount: 8,
triangleCount: 12,
@ -193,6 +203,7 @@ describe ('3ds Importer', function() {
{
name: 'Cube',
vertexCount: 8,
vertexColorCount: 0,
normalCount: 12,
uvCount: 8,
triangleCount: 12,
@ -201,6 +212,7 @@ describe ('3ds Importer', function() {
{
name: 'Cube',
vertexCount: 8,
vertexColorCount: 0,
normalCount: 12,
uvCount: 8,
triangleCount: 12,
@ -209,6 +221,7 @@ describe ('3ds Importer', function() {
{
name: 'Cube',
vertexCount: 8,
vertexColorCount: 0,
normalCount: 12,
uvCount: 8,
triangleCount: 12,
@ -217,6 +230,7 @@ describe ('3ds Importer', function() {
{
name: 'Cube',
vertexCount: 8,
vertexColorCount: 0,
normalCount: 12,
uvCount: 8,
triangleCount: 12,
@ -225,6 +239,7 @@ describe ('3ds Importer', function() {
{
name: 'Cube',
vertexCount: 8,
vertexColorCount: 0,
normalCount: 12,
uvCount: 8,
triangleCount: 12,
@ -233,6 +248,7 @@ describe ('3ds Importer', function() {
{
name: 'Cube',
vertexCount: 8,
vertexColorCount: 0,
normalCount: 12,
uvCount: 8,
triangleCount: 12,

View File

@ -38,6 +38,7 @@ describe ('Gltf Importer', function () {
{
name : '',
vertexCount : 3,
vertexColorCount : 0,
normalCount : 1,
uvCount : 0,
triangleCount : 1,
@ -75,9 +76,9 @@ describe ('Gltf Importer', function () {
name : '',
childNodes : [
{
name : '',
childNodes : [],
meshNames : ['Mesh']
name : '',
childNodes : [],
meshNames : ['Mesh']
}
],
meshNames : []
@ -94,6 +95,7 @@ describe ('Gltf Importer', function () {
{
name : 'Mesh',
vertexCount : 24,
vertexColorCount : 0,
normalCount : 24,
uvCount : 0,
triangleCount : 12,
@ -112,6 +114,62 @@ describe ('Gltf Importer', function () {
}
});
it ('BoxVertexColors', function (done) {
let testFileList = [
['BoxVertexColors/glTF', 'BoxVertexColors.gltf'],
['BoxVertexColors/glTF-Embedded', 'BoxVertexColors.gltf'],
['BoxVertexColors/glTF-Binary', 'BoxVertexColors.glb']
];
let processed = 0;
for (let i = 0; i < testFileList.length; i++) {
let testFile = testFileList[i];
testFiles.ImportGltfFile (testFile[0], testFile[1], function (model) {
assert (OV.CheckModel (model));
assert.deepStrictEqual (testUtils.ModelNodesToTree (model), {
name : '<Root>',
childNodes : [
{
name : 'RootNode',
childNodes : [
{
name : 'Cube',
childNodes : [],
meshNames : ['Cube']
}
],
meshNames : []
}
],
meshNames : []
});
assert.deepStrictEqual (testUtils.ModelToObjectSimple (model), {
name : '',
materials : [
{ name : 'Default' }
],
meshes : [
{
name : 'Cube',
vertexCount : 24,
vertexColorCount : 24,
normalCount : 24,
uvCount : 24,
triangleCount : 12,
boundingBox : {
min : [-0.5, -0.5, -0.5],
max : [0.5, 0.5, 0.5]
}
}
]
});
processed += 1;
if (processed == testFileList.length) {
done ();
}
});
}
});
it ('BoxInterleaved', function (done) {
let testFileList = [
['BoxInterleaved/glTF', 'BoxInterleaved.gltf'],
@ -149,6 +207,7 @@ describe ('Gltf Importer', function () {
{
name : 'Mesh',
vertexCount : 24,
vertexColorCount : 0,
normalCount : 24,
uvCount : 0,
triangleCount : 12,
@ -204,6 +263,7 @@ describe ('Gltf Importer', function () {
{
name : 'Mesh',
vertexCount : 24,
vertexColorCount : 0,
normalCount : 24,
uvCount : 24,
triangleCount : 12,
@ -257,6 +317,7 @@ describe ('Gltf Importer', function () {
{
name : '',
vertexCount : 3,
vertexColorCount : 0,
normalCount : 3,
uvCount : 0,
triangleCount : 1,
@ -268,6 +329,7 @@ describe ('Gltf Importer', function () {
{
name : '',
vertexCount : 3,
vertexColorCount : 0,
normalCount : 3,
uvCount : 0,
triangleCount : 1,
@ -312,6 +374,7 @@ describe ('Gltf Importer', function () {
{
name: 'ArrowMeshZ2',
vertexCount: 78,
vertexColorCount: 0,
normalCount: 78,
uvCount: 0,
triangleCount: 38,
@ -323,6 +386,7 @@ describe ('Gltf Importer', function () {
{
name: 'TargetMeshZ2',
vertexCount: 50,
vertexColorCount: 0,
normalCount: 50,
uvCount: 0,
triangleCount: 26,
@ -334,6 +398,7 @@ describe ('Gltf Importer', function () {
{
name: 'TargetMeshY2',
vertexCount: 50,
vertexColorCount: 0,
normalCount: 50,
uvCount: 0,
triangleCount: 26,
@ -345,6 +410,7 @@ describe ('Gltf Importer', function () {
{
name: 'ArrowMeshY2',
vertexCount: 78,
vertexColorCount: 0,
normalCount: 78,
uvCount: 0,
triangleCount: 38,
@ -356,6 +422,7 @@ describe ('Gltf Importer', function () {
{
name: 'ArrowMeshX2',
vertexCount: 78,
vertexColorCount: 0,
normalCount: 78,
uvCount: 0,
triangleCount: 38,
@ -367,6 +434,7 @@ describe ('Gltf Importer', function () {
{
name: 'TargetMeshX2',
vertexCount: 54,
vertexColorCount: 0,
normalCount: 54,
uvCount: 0,
triangleCount: 26,
@ -378,6 +446,7 @@ describe ('Gltf Importer', function () {
{
name: 'TargetMeshZ1',
vertexCount: 52,
vertexColorCount: 0,
normalCount: 52,
uvCount: 0,
triangleCount: 26,
@ -389,6 +458,7 @@ describe ('Gltf Importer', function () {
{
name: 'ArrowMeshZ1',
vertexCount: 74,
vertexColorCount: 0,
normalCount: 74,
uvCount: 0,
triangleCount: 38,
@ -400,6 +470,7 @@ describe ('Gltf Importer', function () {
{
name: 'TargetMeshX1',
vertexCount: 54,
vertexColorCount: 0,
normalCount: 54,
uvCount: 0,
triangleCount: 26,
@ -411,6 +482,7 @@ describe ('Gltf Importer', function () {
{
name: 'ArrowMeshX1',
vertexCount: 78,
vertexColorCount: 0,
normalCount: 78,
uvCount: 0,
triangleCount: 38,
@ -422,6 +494,7 @@ describe ('Gltf Importer', function () {
{
name: 'TargetMeshY1',
vertexCount: 52,
vertexColorCount: 0,
normalCount: 52,
uvCount: 0,
triangleCount: 26,
@ -433,6 +506,7 @@ describe ('Gltf Importer', function () {
{
name: 'ArrowMeshY1',
vertexCount: 78,
vertexColorCount: 0,
normalCount: 78,
uvCount: 0,
triangleCount: 38,
@ -444,6 +518,7 @@ describe ('Gltf Importer', function () {
{
name: 'BaseCubeMesh',
vertexCount: 272,
vertexColorCount: 0,
normalCount: 272,
uvCount: 0,
triangleCount: 140,
@ -484,6 +559,7 @@ describe ('Gltf Importer', function () {
{
name : '',
vertexCount : 4,
vertexColorCount : 0,
normalCount : 2,
uvCount : 0,
triangleCount : 2,
@ -520,6 +596,7 @@ describe ('Gltf Importer', function () {
{
name : '',
vertexCount : 6,
vertexColorCount : 0,
normalCount : 2,
uvCount : 0,
triangleCount : 2,
@ -557,6 +634,7 @@ describe ('Gltf Importer', function () {
{
name : '',
vertexCount : 14,
vertexColorCount : 0,
normalCount : 12,
uvCount : 0,
triangleCount : 12,

View File

@ -59,7 +59,7 @@ describe ('Obj Importer', function () {
});
done ();
});
});
});
it ('single_rectangle.obj', function (done) {
testFiles.ImportObjFile ('single_rectangle.obj', function (model) {
@ -84,7 +84,7 @@ describe ('Obj Importer', function () {
normals : [0, 0, 1, 0, 0, 1, 0, 0, 1],
uvs : [],
mat : 0
}
}
]
}
]
@ -227,7 +227,7 @@ describe ('Obj Importer', function () {
mat : 0
}
]
}
}
]
});
done ();
@ -269,7 +269,7 @@ describe ('Obj Importer', function () {
});
done ();
});
});
});
it ('single_triangle_with_material.obj', function (done) {
testFiles.ImportObjFile ('single_triangle_with_material.obj', function (model) {
@ -322,7 +322,7 @@ describe ('Obj Importer', function () {
normals : [0, 0, 1, 0, 0, 1, 0, 0, 1],
uvs : [],
mat : 1
}
}
]
}
]
@ -361,7 +361,7 @@ describe ('Obj Importer', function () {
mat : 0
}
]
}
}
]
});
done ();
@ -393,7 +393,7 @@ describe ('Obj Importer', function () {
mat : 0
}
]
}
}
]
});
done ();
@ -425,7 +425,7 @@ describe ('Obj Importer', function () {
mat : 0
}
]
}
}
]
});
done ();
@ -460,12 +460,12 @@ describe ('Obj Importer', function () {
mat : 1
}
]
}
}
]
});
done ();
});
});
});
it ('cube_with_materials.obj', function (done) {
testFiles.ImportObjFile ('cube_with_materials.obj', function (model) {
@ -483,6 +483,7 @@ describe ('Obj Importer', function () {
{
name : 'Cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 6,
uvCount : 4,
triangleCount : 12,
@ -512,6 +513,7 @@ describe ('Obj Importer', function () {
{
name : 'Cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 6,
uvCount : 4,
triangleCount : 12,
@ -542,6 +544,7 @@ describe ('Obj Importer', function () {
{
name : 'Cube',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 6,
uvCount : 4,
triangleCount : 12,
@ -555,7 +558,7 @@ describe ('Obj Importer', function () {
done ();
});
});
it ('cube with white spaces.obj', function (done) {
testFiles.ImportObjFile ('cube with white spaces.obj', function (model) {
assert (OV.CheckModel (model));
@ -572,6 +575,7 @@ describe ('Obj Importer', function () {
{
name : 'Cube Mesh',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 6,
uvCount : 4,
triangleCount : 12,
@ -584,7 +588,7 @@ describe ('Obj Importer', function () {
});
done ();
});
});
});
it ('icosahedron.obj', function (done) {
testFiles.ImportObjFile ('icosahedron.obj', function (model) {
@ -598,6 +602,7 @@ describe ('Obj Importer', function () {
{
name : 'Icosahedron',
vertexCount : 12,
vertexColorCount : 0,
normalCount : 20,
uvCount : 0,
triangleCount : 20,

View File

@ -59,7 +59,7 @@ describe ('Off Importer', function () {
});
done ();
});
});
});
it ('single_rectangle.off', function (done) {
testFiles.ImportOffFile ('single_rectangle.off', function (model) {
@ -84,7 +84,7 @@ describe ('Off Importer', function () {
normals : [0, 0, 1, 0, 0, 1, 0, 0, 1],
uvs : [],
mat : 0
}
}
]
}
]
@ -92,7 +92,7 @@ describe ('Off Importer', function () {
done ();
});
});
it ('single_triangle_with_comments.off', function (done) {
testFiles.ImportOffFile ('single_triangle_with_comments.off', function (model) {
assert (OV.CheckModel (model));
@ -132,6 +132,7 @@ describe ('Off Importer', function () {
{
name : '',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 0,
triangleCount : 12,
@ -144,5 +145,5 @@ describe ('Off Importer', function () {
});
done ();
});
});
});
});

View File

@ -59,7 +59,7 @@ describe ('Ply Importer', function() {
});
done ();
});
});
});
it ('single_rectangle.ply', function (done) {
var model = testFiles.ImportPlyFile ('single_rectangle.ply', function (model) {
@ -84,7 +84,7 @@ describe ('Ply Importer', function() {
normals : [0, 0, 1, 0, 0, 1, 0, 0, 1],
uvs : [],
mat : 0
}
}
]
}
]
@ -92,7 +92,7 @@ describe ('Ply Importer', function() {
done ();
});
});
it ('single_triangle_with_comments.ply', function (done) {
var model = testFiles.ImportPlyFile ('single_triangle_with_comments.ply', function (model) {
assert (OV.CheckModel (model));
@ -131,6 +131,7 @@ describe ('Ply Importer', function() {
{
name : '',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 0,
triangleCount : 12,
@ -157,6 +158,7 @@ describe ('Ply Importer', function() {
{
name : '',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 0,
triangleCount : 12,
@ -169,7 +171,7 @@ describe ('Ply Importer', function() {
});
done ();
});
});
});
it ('cube_meshlab_binary.ply', function (done) {
var model = testFiles.ImportPlyFile ('cube_meshlab_binary.ply', function (model) {
@ -183,6 +185,7 @@ describe ('Ply Importer', function() {
{
name : '',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 0,
triangleCount : 12,
@ -212,6 +215,7 @@ describe ('Ply Importer', function() {
{
name : '',
vertexCount : 8,
vertexColorCount : 0,
normalCount : 12,
uvCount : 0,
triangleCount : 12,
@ -224,5 +228,5 @@ describe ('Ply Importer', function() {
});
done ();
});
});
});
});

View File

@ -53,7 +53,7 @@ describe ('Stl Importer', function() {
});
done ();
});
});
});
it ('single_triangle_no_normal.stl', function (done) {
testFiles.ImportStlFile ('single_triangle_no_normal.stl', function (model) {
@ -79,7 +79,7 @@ describe ('Stl Importer', function() {
});
done ();
});
});
});
it ('two_triangles.stl', function (done) {
testFiles.ImportStlFile ('two_triangles.stl', function (model) {
@ -111,7 +111,7 @@ describe ('Stl Importer', function() {
});
done ();
});
});
});
it ('stl_ascii.stl', function (done) {
testFiles.ImportStlFile ('stl_ascii.stl', function (model) {
@ -125,6 +125,7 @@ describe ('Stl Importer', function() {
{
name : 'Untitled-5427e5af',
vertexCount : 1716,
vertexColorCount : 0,
normalCount : 572,
uvCount : 0,
triangleCount : 572,
@ -151,6 +152,7 @@ describe ('Stl Importer', function() {
{
name : '',
vertexCount : 2184,
vertexColorCount : 0,
normalCount : 728,
uvCount : 0,
triangleCount : 728,
@ -164,7 +166,7 @@ describe ('Stl Importer', function() {
done ();
});
});
it ('cube_meshlab_ascii.stl', function (done) {
testFiles.ImportStlFile ('cube_meshlab_ascii.stl', function (model) {
@ -178,6 +180,7 @@ describe ('Stl Importer', function() {
{
name : 'STL generated by MeshLab',
vertexCount : 36,
vertexColorCount : 0,
normalCount : 12,
uvCount : 0,
triangleCount : 12,
@ -190,7 +193,7 @@ describe ('Stl Importer', function() {
});
done ();
});
});
});
it ('cube_meshlab_binary.stl', function (done) {
testFiles.ImportStlFile ('cube_meshlab_binary.stl', function (model) {
@ -204,6 +207,7 @@ describe ('Stl Importer', function() {
{
name : '',
vertexCount : 36,
vertexColorCount : 0,
normalCount : 12,
uvCount : 0,
triangleCount : 12,
@ -216,5 +220,5 @@ describe ('Stl Importer', function() {
});
done ();
});
});
});
});

View File

@ -144,6 +144,7 @@ module.exports =
let meshObj = {
name : mesh.GetName (),
vertexCount : mesh.VertexCount (),
vertexColorCount : mesh.VertexColorCount (),
normalCount : mesh.NormalCount (),
uvCount : mesh.TextureUVCount (),
triangleCount : mesh.TriangleCount (),