OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_QUADS_DRAW_POLYGON_H_ | |
6 #define CC_QUADS_DRAW_POLYGON_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "cc/base/math_util.h" | |
11 #include "cc/output/bsp_compare_result.h" | |
12 #include "cc/quads/draw_quad.h" | |
13 #include "ui/gfx/point3_f.h" | |
14 #include "ui/gfx/quad_f.h" | |
15 #include "ui/gfx/vector3d_f.h" | |
16 | |
17 namespace cc { | |
18 | |
19 class DrawPolygon { | |
20 public: | |
21 DrawPolygon(); | |
22 ~DrawPolygon(); | |
23 | |
24 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.
| |
25 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.
| |
26 int num_vertices_in_polygon, | |
27 int draw_order_index = 0); | |
28 DrawPolygon(const DrawPolygon& other); | |
enne (OOO)
2014/07/23 21:19:32
You've got a whole bunch of copying functions here
| |
29 | |
30 DrawPolygon& operator=(const DrawPolygon& rhs); | |
31 | |
32 bool Split(const DrawPolygon& splitter, | |
33 scoped_ptr<DrawPolygon>* front, | |
34 scoped_ptr<DrawPolygon>* back); | |
35 float SignedPointDistance(const gfx::Point3F& point) const; | |
36 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
| |
37 | |
38 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
| |
39 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.
| |
40 float area; | |
41 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.
| |
42 | |
43 // Checks polygon a against polygon b and returns which side it lies on, or | |
44 // whether it crosses (necessitating a split in the BSP tree). | |
45 static BspCompareResult SideCompare(const DrawPolygon& a, | |
46 const DrawPolygon& b); | |
47 void ToQuads2D(std::vector<gfx::QuadF>* quads) const; | |
48 int NumPoints() { return points.size(); } | |
49 bool GetInverseTransform(gfx::Transform* transform) const; | |
50 | |
51 // The pointer to the original quad, which gives us all the drawing info | |
52 // we need. | |
53 DrawQuad* original_ref; | |
54 | |
55 // This threshold controls how "thick" a plane is. If a point's distance is | |
56 // <= compare_threshold, then it is considered on the plane. Only when this | |
57 // boundary is crossed do we consider doing splitting. | |
58 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.
| |
59 static float split_threshold; | |
60 | |
61 private: | |
62 void CopyFrom(const DrawPolygon& rhs); | |
63 }; | |
64 | |
65 } // namespace cc | |
66 | |
67 #endif // CC_QUADS_DRAW_POLYGON_H_ | |
OLD | NEW |