Skip to content

Commit 02dce80

Browse files
ref: remove OBJParserTest.matchesOldVbo as backend changed greatly
1 parent a8acb4f commit 02dce80

1 file changed

Lines changed: 0 additions & 58 deletions

File tree

src/test/java/cam72cam/mod/model/common/OBJParserTest.java

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
import cam72cam.mod.model.common.mesh.ModelGroup;
55
import cam72cam.mod.model.common.mesh.VAOLayout;
66
import cam72cam.mod.model.common.util.MalformedModelException;
7-
import cam72cam.mod.model.obj.OBJGroup;
8-
import cam72cam.mod.model.obj.OBJParser;
9-
import cam72cam.mod.model.obj.VertexBuffer;
107
import cam72cam.mod.resource.Identifier;
118
import org.apache.commons.io.FileUtils;
129
import org.junit.Assert;
@@ -265,59 +262,4 @@ public void degenerateFaceIgnored() throws Exception {
265262
// No valid triangle was produced
266263
Assert.assertEquals(0, model.getVboData().length);
267264
}
268-
269-
@Test
270-
public void matchesOldVbo() throws Exception {
271-
// Only triangle faces, as triangulation is a separate concern, not part of this comparison
272-
StringBuilder objData = new StringBuilder();
273-
for (int i = 1; i <= 30; i++) {
274-
objData.append(String.format("v %d %d %d\n", i, i % 7, i % 5));
275-
objData.append(String.format("vt %f %f\n", i / 10f, i % 3 / 3f));
276-
objData.append(String.format("vn %d %d 1\n", i % 2, i % 3));
277-
}
278-
objData.append("o A\n");
279-
for (int i = 0; i < 30; i += 3) {
280-
int a = i + 1, b = i + 2, c = i + 3;
281-
objData.append(String.format("f %d/%d/%d %d/%d/%d %d/%d/%d\n", a, a, a, b, b, b, c, c, c));
282-
if (i == 15) {
283-
objData.append("o B\n");
284-
}
285-
}
286-
String data = objData.toString();
287-
288-
// Old pipeline as a black box: raw VBO geometry (positions/uvs/normals)
289-
OBJParser oldParser = new OBJParser(new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)), 1.0f);
290-
VertexBuffer oldVbo = oldParser.getBuffer();
291-
292-
// New pipeline
293-
Model model = ModelLoader.load(obj(data));
294-
295-
int stride = oldVbo.stride;
296-
Assert.assertEquals(stride, model.getLayout().getStride());
297-
Assert.assertEquals(oldVbo.data.length, model.getVboData().length);
298-
299-
// Vertex data (skipping uv & color) as they're both POS_UV_COLOR_NORMAL
300-
for (int v = 0; v < oldVbo.data.length / stride; v++) {
301-
for (int c = 0; c < stride; c++) {
302-
if (c >= oldVbo.textureOffset && c < oldVbo.textureOffset + 4 || c >= oldVbo.colorOffset && c < oldVbo.colorOffset + 4) {
303-
continue;
304-
}
305-
Assert.assertEquals("vertex " + v + " component " + c, oldVbo.data[v * stride + c], model.getVboData()[v * stride + c], 1e-5);
306-
}
307-
}
308-
Iterator<Map.Entry<String, ModelGroup>> iterator = model.getGroups().entrySet().iterator();
309-
ModelGroup A2 = iterator.next().getValue();
310-
ModelGroup B2 = iterator.next().getValue();
311-
312-
//Group data
313-
OBJGroup A1 = oldParser.getGroups().get(0);
314-
Assert.assertEquals(A1.min, A2.min());
315-
Assert.assertEquals(A1.max, A2.max());
316-
Assert.assertEquals(A1.normal, A2.normal());
317-
318-
OBJGroup B1 = oldParser.getGroups().get(1);
319-
Assert.assertEquals(B1.min, B2.min());
320-
Assert.assertEquals(B1.max, B2.max());
321-
Assert.assertEquals(B1.normal, B2.normal());
322-
}
323265
}

0 commit comments

Comments
 (0)