OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_OUTPUT_BSP_CONTROLLER_H_ |
| 6 #define CC_OUTPUT_BSP_CONTROLLER_H_ |
| 7 |
| 8 #include "cc/output/bsp_compare_result.h" |
| 9 #include "cc/quads/draw_polygon.h" |
| 10 |
| 11 namespace cc { |
| 12 |
| 13 // Specialization of the BSP Controller abstract class that deals specifically |
| 14 // with DrawPolygons |
| 15 class BspController { |
| 16 public: |
| 17 BspController(); |
| 18 |
| 19 // Returns whether or not nodeA is on one or the other side of nodeB, |
| 20 // coplanar, or whether it crosses nodeB's plane and needs to be split |
| 21 static BspCompareResult GetNodePositionRelative(const DrawPolygon& node_a, |
| 22 const DrawPolygon& node_b); |
| 23 // Returns whether or not our viewer is in front of or behind the plane |
| 24 // defined by this polygon/node |
| 25 static BspCompareResult GetCameraPositionRelative(const DrawPolygon& node); |
| 26 static bool SplitPolygon(scoped_ptr<DrawPolygon> polygon, |
| 27 const DrawPolygon& splitter, |
| 28 scoped_ptr<DrawPolygon>* front, |
| 29 scoped_ptr<DrawPolygon>* back); |
| 30 |
| 31 // This heuristic uses the surface area of the polygon to determine whether |
| 32 // or not a polygon is a good splitter. The idea is that if a polygon is |
| 33 // larger, it is more likely to cross the planes of many other polygons, |
| 34 // so using it as a splitter instead avoids many unnecessary splits. |
| 35 virtual float SplitWeight(const DrawPolygon& polygon); |
| 36 |
| 37 // This threshold controls how "thick" a plane is. If a point's distance is |
| 38 // <= compare_threshold, then it is considered on the plane. Only when this |
| 39 // boundary is crossed do we consider doing splitting. |
| 40 static float compare_threshold; |
| 41 static float split_threshold; |
| 42 }; |
| 43 |
| 44 } // namespace cc |
| 45 |
| 46 #endif // CC_OUTPUT_BSP_CONTROLLER_H_ |
OLD | NEW |