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_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 bool polygon_is_original = true); | |
29 DrawPolygon(const DrawPolygon& other); | |
30 | |
31 DrawPolygon& operator=(const DrawPolygon& rhs); | |
32 | |
33 bool Split(const DrawPolygon& splitter, | |
34 double plane_threshold, | |
35 scoped_ptr<DrawPolygon>* front, | |
36 scoped_ptr<DrawPolygon>* back); | |
37 float SignedPointDistance(const gfx::Point3F& point) const; | |
38 bool ApplyTransform(const gfx::Transform& transform); | |
39 | |
40 std::vector<gfx::Point3F> points; | |
41 gfx::Vector3dF normal; | |
42 float area; | |
43 int order_index; | |
44 bool is_original; // Has this been split yet or is it still intact? | |
Ian Vollick
2014/07/16 20:54:33
Apologies if I just missed it, but where's this us
troyhildebrandt
2014/07/18 21:48:27
This is more for the rendering side of things, not
| |
45 | |
46 // Checks polygon a against polygon b and returns which side it lies on, or | |
47 // whether it crosses (necessitating a split in the BSP tree). | |
48 static BspCompareResult SideCompare(const DrawPolygon& a, | |
49 const DrawPolygon& b, | |
50 float z_threshold); | |
51 float Area() const; | |
52 float SignedArea() const; | |
53 void ToQuads2D(std::vector<gfx::QuadF>* quads) const; | |
54 int NumPoints() { return points.size(); } | |
55 bool GetInverseTransform(gfx::Transform* transform) const; | |
56 | |
57 // The pointer to the original quad, which gives us all the drawing info | |
58 // we need. | |
59 DrawQuad* original_ref; | |
60 | |
61 private: | |
62 void CopyFrom(const DrawPolygon& rhs); | |
63 }; | |
64 | |
65 } // namespace cc | |
66 | |
67 #endif // CC_QUADS_DRAW_POLYGON_H_ | |
OLD | NEW |