OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
Ian Vollick
2014/07/22 16:12:15
2014. Here and elsewhere.
| |
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, | |
25 gfx::Point3F* in_points, | |
26 int num_vertices_in_polygon, | |
27 int draw_order_index = 0); | |
28 DrawPolygon(const DrawPolygon& other); | |
29 | |
30 DrawPolygon& operator=(const DrawPolygon& rhs); | |
31 | |
32 bool Split(const DrawPolygon& splitter, | |
33 double plane_threshold, | |
34 scoped_ptr<DrawPolygon>* front, | |
35 scoped_ptr<DrawPolygon>* back); | |
36 float SignedPointDistance(const gfx::Point3F& point) const; | |
37 bool ApplyTransform(const gfx::Transform& transform); | |
38 | |
39 std::vector<gfx::Point3F> points; | |
40 gfx::Vector3dF normal; | |
41 float area; | |
42 int order_index; | |
43 | |
44 // Checks polygon a against polygon b and returns which side it lies on, or | |
45 // whether it crosses (necessitating a split in the BSP tree). | |
46 static BspCompareResult SideCompare(const DrawPolygon& a, | |
47 const DrawPolygon& b, | |
48 float z_threshold); | |
49 void ToQuads2D(std::vector<gfx::QuadF>* quads) const; | |
50 int NumPoints() { return points.size(); } | |
51 bool GetInverseTransform(gfx::Transform* transform) const; | |
52 | |
53 // The pointer to the original quad, which gives us all the drawing info | |
54 // we need. | |
55 DrawQuad* original_ref; | |
56 | |
57 private: | |
58 void CopyFrom(const DrawPolygon& rhs); | |
59 }; | |
60 | |
61 } // namespace cc | |
62 | |
63 #endif // CC_QUADS_DRAW_POLYGON_H_ | |
OLD | NEW |