29 std::string ply_path = blender::tests::flags_test_asset_dir() +
35 const char *header_err =
read_header(infile, header);
36 if (header_err !=
nullptr) {
41 if (!data->error.empty()) {
42 fprintf(stderr,
"%s\n", data->error.c_str());
43 ASSERT_EQ(0,
exp.totvert);
44 ASSERT_EQ(0,
exp.faces_num);
49 ASSERT_EQ(data->vertices.size(),
exp.totvert);
50 ASSERT_EQ(data->edges.size(),
exp.totedge);
51 ASSERT_EQ(data->face_sizes.size(),
exp.faces_num);
52 ASSERT_EQ(data->face_vertices.size(),
exp.totindex);
58 for (
uint32_t face_size : data->face_sizes) {
63 if (!data->face_vertices.is_empty()) {
64 ASSERT_EQ(face_hash,
exp.polyhash);
67 if (!data->edges.is_empty()) {
69 (
const uchar *)data->edges.data(), data->edges.size() *
sizeof(data->edges[0]), 0);
70 ASSERT_EQ(edge_hash,
exp.edgehash);
74 EXPECT_V3_NEAR(data->vertices.first(),
exp.vert_first, 0.0001f);
75 EXPECT_V3_NEAR(data->vertices.last(),
exp.vert_last, 0.0001f);
78 float3 got_normal = data->vertex_normals.is_empty() ?
float3(0, 0, 0) :
79 data->vertex_normals.first();
80 EXPECT_V3_NEAR(got_normal,
exp.normal_first, 0.0001f);
83 float2 got_uv = data->uv_coordinates.is_empty() ?
float2(0, 0) : data->uv_coordinates.first();
84 EXPECT_V2_NEAR(got_uv,
exp.uv_first, 0.0001f);
87 float4 got_color = data->vertex_colors.is_empty() ?
float4(-1, -1, -1, -1) :
88 data->vertex_colors.first();
89 EXPECT_V4_NEAR(got_color,
exp.color_first, 0.0001f);