Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Demos / DX11ClothDemo / capsule.h
1 #include "cap.h"\r
2 #include "cylinder.h"\r
3 \r
4 \r
5 class capsule\r
6 {\r
7         public:\r
8 \r
9         cap topCap;\r
10         cap bottomCap;\r
11         cylinder coreCylinder;\r
12 \r
13         double x_offset, y_offset, z_offset;\r
14         \r
15         int width;\r
16         int height;\r
17         bool top;\r
18 \r
19         btCollisionShape *collisionShape;\r
20         btCollisionObject *collisionObject;\r
21 \r
22         void set_collision_object(btCollisionObject* co)\r
23         {\r
24                 collisionObject = co;\r
25                 topCap.set_collision_object( co );\r
26                 bottomCap.set_collision_object( co );\r
27                 coreCylinder.set_collision_object( co );\r
28         }\r
29 \r
30         void set_collision_shape(btCollisionShape* cs)\r
31         {\r
32                 collisionShape = cs;\r
33                 topCap.set_collision_shape( cs );\r
34                 bottomCap.set_collision_shape( cs );\r
35                 coreCylinder.set_collision_shape( cs );\r
36         }\r
37 \r
38         void create_texture(void)\r
39         {\r
40                 topCap.create_texture();\r
41                 bottomCap.create_texture();\r
42                 coreCylinder.create_texture();\r
43         }\r
44 \r
45         void destroy()\r
46         {\r
47                 topCap.destroy();\r
48                 bottomCap.destroy();\r
49                 coreCylinder.destroy();\r
50         }\r
51 \r
52         void draw(void)\r
53         {\r
54                 topCap.draw();\r
55                 bottomCap.draw();\r
56                 coreCylinder.draw();\r
57         }\r
58 \r
59 \r
60         // paddingFactor is the amount of padding to allow the capsule collider around the \r
61         void create_buffers(int width_, int height_)\r
62         {\r
63                 topCap.create_buffers(width_, height_, true);\r
64                 bottomCap.create_buffers(width_, height_, false);\r
65                 coreCylinder.create_buffers(width_, height_);\r
66         }\r
67 };\r