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

Side by Side Diff: cc/output/bsp_tree.cc

Issue 595593002: Splitting of layers for correct intersections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/output/bsp_walk_action.h » ('j') | cc/output/geometry_binding.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/bsp_tree.h" 5 #include "cc/output/bsp_tree.h"
6 6
7 #include <list> 7 #include <list>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 while (polygon_list->size() > 0) { 46 while (polygon_list->size() > 0) {
47 // Is this particular polygon in front of or behind our splitting polygon. 47 // Is this particular polygon in front of or behind our splitting polygon.
48 BspCompareResult comparer_result = 48 BspCompareResult comparer_result =
49 GetNodePositionRelative(*polygon_list->front(), *(node->node_data)); 49 GetNodePositionRelative(*polygon_list->front(), *(node->node_data));
50 50
51 // If it's clearly behind or in front of the splitting plane, we use the 51 // If it's clearly behind or in front of the splitting plane, we use the
52 // heuristic to decide whether or not we should put it at the back 52 // heuristic to decide whether or not we should put it at the back
53 // or front of the list. 53 // or front of the list.
54 switch (comparer_result) { 54 switch (comparer_result) {
55 case BSP_FRONT: 55 case BSP_FRONT:
56 front_list.push_back(polygon_list->take_front().Pass()); 56 front_list.push_front(polygon_list->take_front().Pass());
57 break; 57 break;
58 case BSP_BACK: 58 case BSP_BACK:
59 back_list.push_back(polygon_list->take_front().Pass()); 59 back_list.push_front(polygon_list->take_front().Pass());
60 break; 60 break;
61 case BSP_SPLIT: 61 case BSP_SPLIT:
62 { 62 {
63 scoped_ptr<DrawPolygon> polygon; 63 scoped_ptr<DrawPolygon> polygon;
64 scoped_ptr<DrawPolygon> new_front; 64 scoped_ptr<DrawPolygon> new_front;
65 scoped_ptr<DrawPolygon> new_back; 65 scoped_ptr<DrawPolygon> new_back;
66 bool split_result = false;
67 // Time to split this geometry, *it needs to be split by node_data. 66 // Time to split this geometry, *it needs to be split by node_data.
68 polygon = polygon_list->take_front(); 67 polygon = polygon_list->take_front();
69 split_result = 68 bool split_result =
70 polygon->Split(*(node->node_data), &new_front, &new_back); 69 polygon->Split(*(node->node_data), &new_front, &new_back);
71 DCHECK(split_result); 70 DCHECK(split_result);
72 if (!split_result) { 71 if (!split_result) {
73 break; 72 break;
74 } 73 }
75 front_list.push_back(new_front.Pass()); 74 front_list.push_back(new_front.Pass());
76 back_list.push_back(new_back.Pass()); 75 back_list.push_back(new_back.Pass());
77 break; 76 break;
78 } 77 }
79 case BSP_COPLANAR_FRONT: 78 case BSP_COPLANAR_FRONT:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if (node.normal().z() > 0.0f) { 111 if (node.normal().z() > 0.0f) {
113 return BSP_FRONT; 112 return BSP_FRONT;
114 } 113 }
115 return BSP_BACK; 114 return BSP_BACK;
116 } 115 }
117 116
118 BspTree::~BspTree() { 117 BspTree::~BspTree() {
119 } 118 }
120 119
121 } // namespace cc 120 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/bsp_walk_action.h » ('j') | cc/output/geometry_binding.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698