Browse Source

ObjImporter: use human readable names for invalid meshes.

NoReasonToMakeThoseCrypticCamelCase.
pull/578/head
Vladimír Vondruš 4 years ago
parent
commit
1226c9506b
  1. 46
      src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp
  2. 12
      src/MagnumPlugins/ObjImporter/Test/invalid-incomplete-data.obj
  3. 4
      src/MagnumPlugins/ObjImporter/Test/invalid-inconsistent-index-tuple.obj
  4. 20
      src/MagnumPlugins/ObjImporter/Test/invalid-number-count.obj
  5. 10
      src/MagnumPlugins/ObjImporter/Test/invalid-numbers.obj
  6. 4
      src/MagnumPlugins/ObjImporter/Test/invalid-optional-coordinate.obj

46
src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp

@ -98,53 +98,53 @@ const struct {
const char* name; const char* name;
const char* message; const char* message;
} InvalidNumbersData[]{ } InvalidNumbersData[]{
{"WrongFloat", "error while converting numeric data"}, {"invalid float literal", "error while converting numeric data"},
{"WrongInteger", "error while converting numeric data"}, {"invalid integer literal", "error while converting numeric data"},
{"PositionIndexOutOfRange", "index 1 out of range for 1 vertices"}, {"position index out of range", "index 1 out of range for 1 vertices"},
{"TextureIndexOutOfRange", "index 2 out of range for 1 vertices"}, {"texture index out of range", "index 2 out of range for 1 vertices"},
{"ZeroIndex", "index 0 out of range for 1 vertices"} {"zero index", "index 0 out of range for 1 vertices"}
}; };
const struct { const struct {
const char* name; const char* name;
const char* message; const char* message;
} InvalidNumberCountData[]{ } InvalidNumberCountData[]{
{"ShortFloat", "invalid float array size"}, {"two-component position", "invalid float array size"},
{"LongFloat", "invalid float array size"}, {"five-component position with optional fourth component", "invalid float array size"},
{"LongOptionalFloat", "invalid float array size"}, {"four-component normal", "invalid float array size"},
{"InvalidIndices", "invalid index data"}, {"four-component index tuple", "invalid index data"},
{"WrongPointIndices", "wrong index count for point"}, {"point with two indices", "wrong index count for point"},
{"WrongLineIndices", "wrong index count for line"}, {"line with one index", "wrong index count for line"},
{"WrongTriangleIndices", "wrong index count for triangle"}, {"triangle with two indices", "wrong index count for triangle"},
{"PolygonIndices", "polygons are not supported"} {"quad", "polygons are not supported"}
}; };
const struct { const struct {
const char* name; const char* name;
const char* message; const char* message;
} InvalidInconsistentIndexTupleData[]{ } InvalidInconsistentIndexTupleData[]{
{"ShortNormalIndices", "some normal indices are missing"}, {"missing normal reference", "some normal indices are missing"},
{"ShortTextureIndices", "some texture coordinate indices are missing"}, {"missing texture reference", "some texture coordinate indices are missing"},
}; };
const struct { const struct {
const char* name; const char* name;
const char* message; const char* message;
} InvalidIncompleteDataData[]{ } InvalidIncompleteDataData[]{
{"MissingPositionData", "incomplete position data"}, {"missing position data", "incomplete position data"},
{"MissingPositionIndices", "incomplete position data"}, {"missing position indices", "incomplete position data"},
{"MissingNormalData", "incomplete normal data"}, {"missing normal data", "incomplete normal data"},
{"MissingNormalIndices", "incomplete normal data"}, {"missing normal indices", "incomplete normal data"},
{"MissingTextureData", "incomplete texture coordinate data"}, {"missing texture coordinate data", "incomplete texture coordinate data"},
{"MissingTextureIndices", "incomplete texture coordinate data"}, {"missing texture coordinate indices", "incomplete texture coordinate data"},
}; };
const struct { const struct {
const char* name; const char* name;
const char* message; const char* message;
} InvalidOptionalCoordinateData[]{ } InvalidOptionalCoordinateData[]{
{"UnsupportedPositionW", "homogeneous coordinates are not supported"}, {"position with optional fourth component not one", "homogeneous coordinates are not supported"},
{"UnsupportedTextureW", "3D texture coordinates are not supported"} {"texture with optional third component not zero", "3D texture coordinates are not supported"}
}; };
ObjImporterTest::ObjImporterTest() { ObjImporterTest::ObjImporterTest() {

12
src/MagnumPlugins/ObjImporter/Test/invalid-incomplete-data.obj

@ -1,23 +1,23 @@
o MissingPositionData o missing position data
p 1 p 1
o MissingPositionIndices o missing position indices
v 1 2 3 v 1 2 3
o MissingNormalData o missing normal data
v 1 2 3 v 1 2 3
p 3//3 p 3//3
o MissingNormalIndices o missing normal indices
v 1 2 3 v 1 2 3
vn 1 2 3 vn 1 2 3
p 4 p 4
o MissingTextureData o missing texture coordinate data
v 1 2 3 v 1 2 3
p 5/1 p 5/1
o MissingTextureIndices o missing texture coordinate indices
v 1 2 3 v 1 2 3
vt 1 2 vt 1 2
p 6 p 6

4
src/MagnumPlugins/ObjImporter/Test/invalid-inconsistent-index-tuple.obj

@ -1,11 +1,11 @@
o ShortNormalIndices o missing normal reference
v 1 2 3 v 1 2 3
vn 1 2 3 vn 1 2 3
p 1//1 p 1//1
p 1 p 1
p 1//1 p 1//1
o ShortTextureIndices o missing texture reference
v 1 2 3 v 1 2 3
vt 1 2 vt 1 2
p 2/2 p 2/2

20
src/MagnumPlugins/ObjImporter/Test/invalid-number-count.obj

@ -1,29 +1,29 @@
o ShortFloat o two-component position
v 0.5 1.0 v 0.5 1.0
o LongFloat o five-component position with optional fourth component
v 0.5 1 2 0.0 3.5
o four-component normal
v 0.5 1 2 v 0.5 1 2
vn 0.5 1.0 2.3 7.4 vn 0.5 1.0 2.3 7.4
o LongOptionalFloat o four-component index tuple
v 0.5 1 2 0.0 3.5
o InvalidIndices
v 1 2 3 v 1 2 3
p 4/1/1/1 p 4/1/1/1
o WrongPointIndices o point with two indices
v 1 2 3 v 1 2 3
p 5 5 p 5 5
o WrongLineIndices o line with one index
v 1 2 3 v 1 2 3
l 6 l 6
o WrongTriangleIndices o triangle with two indices
v 1 2 3 v 1 2 3
f 7 7 f 7 7
o PolygonIndices o quad
v 1 2 3 v 1 2 3
f 8 8 8 8 f 8 8 8 8

10
src/MagnumPlugins/ObjImporter/Test/invalid-numbers.obj

@ -1,22 +1,22 @@
o WrongFloat o invalid float literal
v 1 bleh 2 v 1 bleh 2
p 1 p 1
o WrongInteger o invalid integer literal
v 1 0 2 v 1 0 2
p bleh p bleh
o PositionIndexOutOfRange o position index out of range
v 1 0 2 v 1 0 2
# Should be 3 # Should be 3
p 1 p 1
o TextureIndexOutOfRange o texture index out of range
v 1 0 2 v 1 0 2
vt 0 1 vt 0 1
# Should be 4/1 # Should be 4/1
p 4/2 p 4/2
o ZeroIndex o zero index
v 1 0 2 v 1 0 2
p 0 p 0

4
src/MagnumPlugins/ObjImporter/Test/invalid-optional-coordinate.obj

@ -1,8 +1,8 @@
o UnsupportedPositionW o position with optional fourth component not one
v 1.5 2 3 0.8 v 1.5 2 3 0.8
p 1 p 1
o UnsupportedTextureW o texture with optional third component not zero
v 1.5 2 3 v 1.5 2 3
vt 0.5 0.7 0.5 vt 0.5 0.7 0.5
p 2/1 p 2/1

Loading…
Cancel
Save