Index: cc/quads/draw_polygon.h |
diff --git a/cc/quads/draw_polygon.h b/cc/quads/draw_polygon.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a97b08302876421db7180cbeb5f64fb8633335b3 |
--- /dev/null |
+++ b/cc/quads/draw_polygon.h |
@@ -0,0 +1,67 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CC_QUADS_DRAW_POLYGON_H_ |
+#define CC_QUADS_DRAW_POLYGON_H_ |
+ |
+#include <vector> |
+ |
+#include "cc/base/math_util.h" |
+#include "cc/output/bsp_compare_result.h" |
+#include "cc/quads/draw_quad.h" |
+#include "ui/gfx/point3_f.h" |
+#include "ui/gfx/quad_f.h" |
+#include "ui/gfx/vector3d_f.h" |
+ |
+namespace cc { |
+ |
+class DrawPolygon { |
+ public: |
+ DrawPolygon(); |
+ ~DrawPolygon(); |
+ |
+ DrawPolygon(DrawQuad* original_ref, |
enne (OOO)
2014/07/23 21:19:32
I'm not super keen on these raw pointers. I know
troyhildebrandt
2014/07/24 00:43:21
Done.
|
+ gfx::Point3F* in_points, |
enne (OOO)
2014/07/23 21:19:32
Could this be const std::vector<gfx::Point3F>&, ra
troyhildebrandt
2014/07/24 00:43:21
Done.
|
+ int num_vertices_in_polygon, |
+ int draw_order_index = 0); |
+ DrawPolygon(const DrawPolygon& other); |
enne (OOO)
2014/07/23 21:19:32
You've got a whole bunch of copying functions here
|
+ |
+ DrawPolygon& operator=(const DrawPolygon& rhs); |
+ |
+ bool Split(const DrawPolygon& splitter, |
+ scoped_ptr<DrawPolygon>* front, |
+ scoped_ptr<DrawPolygon>* back); |
+ float SignedPointDistance(const gfx::Point3F& point) const; |
+ void ApplyTransform(const gfx::Transform& transform); |
enne (OOO)
2014/07/23 21:19:32
Where does this function get used? Is this in GLRe
troyhildebrandt
2014/07/24 00:43:21
Yea, this is used in the grander scheme of things
|
+ |
+ std::vector<gfx::Point3F> points; |
enne (OOO)
2014/07/23 21:19:32
Are these mutable after construction? Should they
troyhildebrandt
2014/07/24 00:43:21
In order to implement the CreateCopy() function ef
enne (OOO)
2014/07/24 01:04:42
Yeah, but CreateCopy is a member function so has a
troyhildebrandt
2014/07/24 18:07:21
You're right, I made all the member variables priv
|
+ gfx::Vector3dF normal; |
enne (OOO)
2014/07/23 21:19:32
You should document with a comment if normal is no
troyhildebrandt
2014/07/24 00:43:21
Done.
|
+ float area; |
+ int order_index; |
enne (OOO)
2014/07/23 21:19:32
This needs a comment to explain what it is.
troyhildebrandt
2014/07/24 00:43:21
Done.
|
+ |
+ // Checks polygon a against polygon b and returns which side it lies on, or |
+ // whether it crosses (necessitating a split in the BSP tree). |
+ static BspCompareResult SideCompare(const DrawPolygon& a, |
+ const DrawPolygon& b); |
+ void ToQuads2D(std::vector<gfx::QuadF>* quads) const; |
+ int NumPoints() { return points.size(); } |
+ bool GetInverseTransform(gfx::Transform* transform) const; |
+ |
+ // The pointer to the original quad, which gives us all the drawing info |
+ // we need. |
+ DrawQuad* original_ref; |
+ |
+ // This threshold controls how "thick" a plane is. If a point's distance is |
+ // <= compare_threshold, then it is considered on the plane. Only when this |
+ // boundary is crossed do we consider doing splitting. |
+ static float compare_threshold; |
enne (OOO)
2014/07/23 21:19:32
I don't think you should put these in the header.
troyhildebrandt
2014/07/24 00:43:21
At least one, compare_threshold, needs to visible
enne (OOO)
2014/07/24 01:04:42
I looked at that code, and I think you should just
troyhildebrandt
2014/07/24 18:07:21
Done.
|
+ static float split_threshold; |
+ |
+ private: |
+ void CopyFrom(const DrawPolygon& rhs); |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_QUADS_DRAW_POLYGON_H_ |