Reverted incorrect merge (missing files)
[blender.git] / extern / solid / src / broad / BP_Scene.h
1 /*
2  * SOLID - Software Library for Interference Detection
3  * 
4  * Copyright (C) 2001-2003  Dtecta.  All rights reserved.
5  *
6  * This library may be distributed under the terms of the Q Public License
7  * (QPL) as defined by Trolltech AS of Norway and appearing in the file
8  * LICENSE.QPL included in the packaging of this file.
9  *
10  * This library may be distributed and/or modified under the terms of the
11  * GNU General Public License (GPL) version 2 as published by the Free Software
12  * Foundation and appearing in the file LICENSE.GPL included in the
13  * packaging of this file.
14  *
15  * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17  *
18  * Commercial use or any other use of this library not covered by either 
19  * the QPL or the GPL requires an additional license from Dtecta. 
20  * Please contact info@dtecta.com for enquiries about the terms of commercial
21  * use of this library.
22  */
23
24 #ifndef BP_SCENE_H
25 #define BP_SCENE_H
26
27 #include <SOLID_broad.h>
28
29 #include "BP_EndpointList.h"
30 #include "BP_ProxyList.h"
31
32 class BP_Proxy;
33
34 class BP_Scene {
35 public:
36     BP_Scene(void *client_data,
37                          BP_Callback beginOverlap,
38                          BP_Callback endOverlap) 
39       : m_client_data(client_data),
40                 m_beginOverlap(beginOverlap),
41                 m_endOverlap(endOverlap),
42                 m_proxies(20)
43         {}
44
45     ~BP_Scene() {}
46
47     BP_Proxy *createProxy(void *object, 
48                                                   const DT_Vector3 min,
49                                                   const DT_Vector3 max);
50
51     void destroyProxy(BP_Proxy *proxy);
52         
53         void *rayCast(BP_RayCastCallback objectRayCast,
54                                   void *client_data,
55                                   const DT_Vector3 source, 
56                                   const DT_Vector3 target, 
57                                   DT_Scalar& lambda) const;
58         
59         void callBeginOverlap(void *object1, void *object2) 
60         {
61                 (*m_beginOverlap)(m_client_data, object1, object2);
62         }
63         
64         void callEndOverlap(void *object1, void *object2) 
65         {
66                 (*m_endOverlap)(m_client_data, object1, object2);
67         }
68         
69         BP_EndpointList& getList(int i) { return m_endpointList[i]; }
70
71 private:
72         void                    *m_client_data;
73         BP_Callback              m_beginOverlap; 
74         BP_Callback              m_endOverlap; 
75     BP_EndpointList          m_endpointList[3];
76         mutable BP_ProxyList     m_proxies;
77 };
78
79 #endif