Chromium Code Reviews| 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..7e8b7d1d54b12fabc672582d9eb572e92497a8b4 |
| --- /dev/null |
| +++ b/cc/quads/draw_polygon.h |
| @@ -0,0 +1,67 @@ |
| +// Copyright 2013 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, |
| + gfx::Point3F* in_points, |
| + int num_vertices_in_polygon, |
| + int draw_order_index = 0, |
| + bool polygon_is_original = true); |
| + DrawPolygon(const DrawPolygon& other); |
| + |
| + DrawPolygon& operator=(const DrawPolygon& rhs); |
| + |
| + bool Split(const DrawPolygon& splitter, |
| + double plane_threshold, |
| + scoped_ptr<DrawPolygon>* front, |
| + scoped_ptr<DrawPolygon>* back); |
| + float SignedPointDistance(const gfx::Point3F& point) const; |
| + bool ApplyTransform(const gfx::Transform& transform); |
| + |
| + std::vector<gfx::Point3F> points; |
| + gfx::Vector3dF normal; |
| + float area; |
| + int order_index; |
| + 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
|
| + |
| + // 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, |
| + float z_threshold); |
| + float Area() const; |
| + float SignedArea() const; |
| + 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; |
| + |
| + private: |
| + void CopyFrom(const DrawPolygon& rhs); |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_QUADS_DRAW_POLYGON_H_ |