edge_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 #pragma once
30 
31 #include "../../api_physics2d.h"
32 #include "../../../Core/Math/vec2.h"
33 #include "../../Collision/Shapes/shape.h"
34 
35 namespace clan
36 {
39 
40 class PhysicsContext;
41 class PhysicsWorld;
42 class EdgeShape_Impl;
43 
48 class CL_API_PHYSICS EdgeShape : public Shape
49 {
52 public:
53 
55  EdgeShape();
56 
60  EdgeShape(const PhysicsWorld &pw);
61 
65  EdgeShape(const PhysicsContext &pc);
66 
67  ~EdgeShape();
68 
72 public:
73 
75  bool is_null() const { return !impl; }
76 
78  void throw_if_null() const;
79 
83 public:
84 
86  EdgeShape &operator =(const EdgeShape &copy);
87 
88  //Add us
89 
91  void set (const Vec2f &v1, const Vec2f &v2);
92 
93  //b2Shape * Clone (b2BlockAllocator *allocator) const
94  //int32 GetChildCount () const
95  //bool TestPoint (const b2Transform &transform, const b2Vec2 &p) const
96  //bool RayCast (b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform, int32 childIndex) const
97  //void ComputeAABB (b2AABB *aabb, const b2Transform &transform, int32 childIndex) const
98  //void ComputeMass (b2MassData *massData, float32 density) const
99  //Add us
100 
104 private:
105 
106  std::shared_ptr<EdgeShape_Impl> impl;
107 
109  friend class FixtureDescription;
110 };
111 
112 }
113 
114 /// \}
bool is_null() const
Returns true if this object is invalid.
Definition: edge_shape.h:75
Shape class.
Definition: shape.h:49
Top-level world class.
Definition: physics_world.h:52
Edge Shape class.
Definition: edge_shape.h:48
Definition: physics_context.h:45
FixtureDescription class.
Definition: fixture_description.h:40