polygon_shape.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Arkadiusz Kalinowski
27 */
28 
29 
30 
31 #pragma once
32 
33 #include "../../api_physics2d.h"
34 #include "../../../Core/Math/vec2.h"
35 #include "../../Collision/Shapes/shape.h"
36 
37 namespace clan
38 {
41 
42 class PhysicsContext;
43 class PhysicsWorld;
44 class PolygonShape_Impl;
45 class Angle;
46 
52 class CL_API_PHYSICS PolygonShape : public Shape
53 {
56 public:
57 
59  PolygonShape();
60 
64  PolygonShape(const PhysicsWorld &pw);
65 
69  PolygonShape(const PhysicsContext &pc);
70 
71  ~PolygonShape();
72 
76 public:
77 
79  bool is_null() const { return !impl; }
80 
82  void throw_if_null() const;
83 
87 public:
88 
90  PolygonShape &operator =(const PolygonShape &copy);
91 
92  //Add us
93  //b2Shape * Clone (b2BlockAllocator *allocator) const
94  //int32 GetChildCount () const
95  //void Set (const b2Vec2 *vertices, int32 vertexCount)
96 
97  void set_as_box (float width, float height);
98  void set_as_box (float width, float height, const Vec2f &center, Angle &angle);
99  //bool TestPoint (const b2Transform &transform, const b2Vec2 &p) const
100  //bool RayCast (b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform, int32 childIndex) const
101  //void ComputeAABB (b2AABB *aabb, const b2Transform &transform, int32 childIndex) const
102  //void ComputeMass (b2MassData *massData, float32 density) const
103  //int32 GetVertexCount () const
104  //const b2Vec2 & GetVertex (int32 index) const
105  //Add us
106 
110 private:
111 
112  std::shared_ptr<PolygonShape_Impl> impl;
113 
115  friend class FixtureDescription;
116 };
117 
118 }
119 
120 /// \}
Angle class.
Definition: angle.h:63
Shape class.
Definition: shape.h:49
bool is_null() const
Returns true if this object is invalid.
Definition: polygon_shape.h:79
Top-level world class.
Definition: physics_world.h:52
Definition: physics_context.h:45
Polygon Shape class.
Definition: polygon_shape.h:52
FixtureDescription class.
Definition: fixture_description.h:40