Overte C++ Documentation
ShapeFactory.h
1 //
2 // ShapeFactory.h
3 // libraries/physics/src
4 //
5 // Created by Andrew Meadows 2014.12.01
6 // Copyright 2014 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_ShapeFactory_h
13 #define hifi_ShapeFactory_h
14 
15 #include <btBulletDynamicsCommon.h>
16 #include <glm/glm.hpp>
17 #include <QObject>
18 #include <QtCore/QRunnable>
19 
20 #include <ShapeInfo.h>
21 
22 // The ShapeFactory assembles and correctly disassembles btCollisionShapes.
23 
24 namespace ShapeFactory {
25  const btCollisionShape* createShapeFromInfo(const ShapeInfo& info);
26  void deleteShape(const btCollisionShape* shape);
27 
28  class Worker : public QObject, public QRunnable {
29  Q_OBJECT
30  public:
31  Worker(const ShapeInfo& info) : shapeInfo(info), shape(nullptr) {}
32  void run() override;
33  ShapeInfo shapeInfo;
34  const btCollisionShape* shape;
35  signals:
36  void submitWork(Worker*);
37  };
38 };
39 
40 #endif // hifi_ShapeFactory_h