Download
Documentation
Development
Examples
Donations
Contributions
Forum
Main Page
Related Pages
Modules
Classes
Sources
API
Physics2D
Collision
Shapes
chain_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
ChainShape_Impl;
43
class
CollisionOutline;
44
52
class
CL_API_PHYSICS
ChainShape
:
public
Shape
53
{
56
public
:
57
59
ChainShape
();
60
64
ChainShape
(
const
PhysicsWorld
&pw);
65
69
ChainShape
(
const
PhysicsContext
&pc);
70
71
~
ChainShape
();
72
76
public
:
77
79
bool
is_null
()
const
{
return
!impl; }
80
82
void
throw_if_null()
const
;
83
87
public
:
88
90
ChainShape
&operator =(
const
ChainShape
©);
91
92
//add us
97
void
create_loop (
const
Vec2f
*vertices,
const
int
count);
98
99
100
void
create_loop (
const
CollisionOutline
&outline);
105
void
create_chain (
const
Vec2f
*vertices,
const
int
count);
106
108
void
set_prev_vertex (
const
Vec2f
&prev_vertex);
109
111
void
set_next_vertex (
const
Vec2f
&next_vertex);
112
//b2Shape * Clone (b2BlockAllocator *allocator) const
113
//int32 GetChildCount () const
114
//void GetChildEdge (b2EdgeShape *edge, int32 index) const
115
//bool TestPoint (const b2Transform &transform, const b2Vec2 &p) const
116
//bool RayCast (b2RayCastOutput *output, const b2RayCastInput &input, const b2Transform &transform, int32 childIndex) const
117
//void ComputeAABB (b2AABB *aabb, const b2Transform &transform, int32 childIndex) const
118
//void ComputeMass (b2MassData *massData, float32 density) const
119
//add us
123
private
:
124
125
std::shared_ptr<ChainShape_Impl> impl;
126
128
friend
class
FixtureDescription
;
129
};
130
131
}
132
133
/// \}
clan::Shape
Shape class.
Definition:
shape.h:49
clan::PhysicsWorld
Top-level world class.
Definition:
physics_world.h:52
clan::CollisionOutline
Collision detection outline.
Definition:
collision_outline.h:114
clan::Vec2< float >
clan::ChainShape
Chain Shape class.
Definition:
chain_shape.h:52
clan::PhysicsContext
Definition:
physics_context.h:45
clan::FixtureDescription
FixtureDescription class.
Definition:
fixture_description.h:40
clan::ChainShape::is_null
bool is_null() const
Returns true if this object is invalid.
Definition:
chain_shape.h:79