Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2899)

Unified Diff: cc/quads/draw_polygon.h

Issue 384083002: WIP BSP Tree for 3D Layer Sorting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..4288ca4acb4d3bc6420bb0a96c0d03dddcb8c25c
--- /dev/null
+++ b/cc/quads/draw_polygon.h
@@ -0,0 +1,65 @@
+// 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/19 00:45:01 This should also be removed until the patch that u
troyhildebrandt 2014/07/21 19:16:50 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,
+ float z_threshold);
+ 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_

Powered by Google App Engine
This is Rietveld 408576698