Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Unified Diff: cc/output/bsp_tree_unittest.cc

Issue 2060183003: Revert of Perform BSP polygon splitting and orientation selection in a single step. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/bsp_tree.cc ('k') | cc/quads/draw_polygon.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/bsp_tree_unittest.cc
diff --git a/cc/output/bsp_tree_unittest.cc b/cc/output/bsp_tree_unittest.cc
index c787d3e7c492a0333be7fcf6f364f20687b918c5..acf2defe533b6d6e5ade0645fe22e85f86f96320 100644
--- a/cc/output/bsp_tree_unittest.cc
+++ b/cc/output/bsp_tree_unittest.cc
@@ -45,32 +45,6 @@
EXPECT_TRUE(VerifySidedness(bsp_tree.root()));
}
- static BspCompareResult SideCompare(const DrawPolygon& a,
- const DrawPolygon& b) {
- const float split_threshold = 0.05f;
- bool pos = false;
- bool neg = false;
- for (const auto& pt : a.points()) {
- float dist = b.SignedPointDistance(pt);
- neg |= dist < -split_threshold;
- pos |= dist > split_threshold;
- }
- if (pos && neg)
- return BSP_SPLIT;
- if (neg)
- return BSP_BACK;
- if (pos)
- return BSP_FRONT;
- double dot = gfx::DotProduct(a.normal(), b.normal());
- if ((dot >= 0.0f && a.order_index() >= b.order_index()) ||
- (dot <= 0.0f && a.order_index() <= b.order_index())) {
- // The sign of the dot product of the normals along with document order
- // determine which side it goes on, the vertices are ambiguous.
- return BSP_COPLANAR_BACK;
- }
- return BSP_COPLANAR_FRONT;
- }
-
static bool VerifySidedness(const std::unique_ptr<BspNode>& node) {
// We check if both the front and back child nodes have geometry that is
// completely on the expected side of the current node.
@@ -78,8 +52,8 @@
bool back_ok = true;
if (node->back_child) {
// Make sure the back child lies entirely behind this node.
- BspCompareResult result =
- SideCompare(*(node->back_child->node_data), *(node->node_data));
+ BspCompareResult result = DrawPolygon::SideCompare(
+ *(node->back_child->node_data), *(node->node_data));
if (result != BSP_BACK) {
return false;
}
@@ -87,8 +61,8 @@
}
// Make sure the front child lies entirely in front of this node.
if (node->front_child) {
- BspCompareResult result =
- SideCompare(*(node->front_child->node_data), *(node->node_data));
+ BspCompareResult result = DrawPolygon::SideCompare(
+ *(node->front_child->node_data), *(node->node_data));
if (result != BSP_FRONT) {
return false;
}
@@ -100,15 +74,15 @@
// Now we need to make sure our coplanar geometry is all actually coplanar.
for (size_t i = 0; i < node->coplanars_front.size(); i++) {
- BspCompareResult result =
- SideCompare(*(node->coplanars_front[i]), *(node->node_data));
+ BspCompareResult result = DrawPolygon::SideCompare(
+ *(node->coplanars_front[i]), *(node->node_data));
if (result != BSP_COPLANAR_FRONT) {
return false;
}
}
for (size_t i = 0; i < node->coplanars_back.size(); i++) {
- BspCompareResult result =
- SideCompare(*(node->coplanars_back[i]), *(node->node_data));
+ BspCompareResult result = DrawPolygon::SideCompare(
+ *(node->coplanars_back[i]), *(node->node_data));
if (result != BSP_COPLANAR_BACK) {
return false;
}
« no previous file with comments | « cc/output/bsp_tree.cc ('k') | cc/quads/draw_polygon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698