* model loading now works with a non ordered 3d model file.
[hkl3d.git] / hkl3d / hkl3d.h
blob9fc6966c7f9ddb23158cebbe66bc58dc51d0f180
1 /* This file is part of the hkl3d library.
3 * The hkl library is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * The hkl library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with the hkl library. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright (C) 2010 Synchrotron SOLEIL
17 * L'Orme des Merisiers Saint-Aubin
18 * BP 48 91192 GIF-sur-YVETTE CEDEX
20 * Authors: Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>
21 * Oussama SBOUI <oussama.sboui@synchrotron-soleil.fr>
24 #ifndef __HKL3D_H__
25 #define __HKL3D_H__
27 #include <hkl.h>
28 #include <g3d/g3d.h>
29 #include <vector>
31 // forward declaration due to bullet static linking
32 class btCollisionObject;
33 class btCollisionWorld;
34 class btCollisionConfiguration;
35 class btBroadphaseInterface;
36 class btCollisionDispatcher;
37 class btCollisionShape;
38 class btVector3;
39 class btTriangleMesh;
41 class Hkl3D
43 public:
44 Hkl3D(const char *filename, HklGeometry * geometry);
46 ~Hkl3D(void);
48 bool is_colliding(void);
49 bool isModelFileCompatibleWithGeometry(void);
50 void loadG3dFaceInBtConvexHullShape(void);
52 HklGeometry * _geometry; // do not own this object
53 size_t _len;
54 G3DContext *_context;
55 G3DModel *_model;
56 btCollisionDispatcher *_btDispatcher;
57 btCollisionConfiguration *_btCollisionConfiguration;
58 btBroadphaseInterface *_btBroadphase;
59 std::vector<btCollisionObject *> _btCollisionObjects;
60 std::vector<btVector3> _colors;
61 std::vector<btCollisionShape *> _btCollisionShapes;
62 std::vector<btTriangleMesh *> _btMeshes;
63 std::vector<std::vector<btCollisionObject *> > _movingBtCollisionObjects;
64 btCollisionWorld *_btCollisionWorld;
67 #endif