H3D API  2.4.1
H3DApi.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
24 //
29 
32 
33 #ifndef __H3DApi_H__
34 #define __H3DApi_H__
35 
36 #include <HAPI/HAPI.h>
37 
38 #if defined(__APPLE__) && defined(__MACH__)
39 #define MACOSX
40 #define H3D_OSX
41 #define H3DAPI_API
42 #ifndef HAVE_SYS_TIME_H
43 #define HAVE_SYS_TIME_H 1
44 #endif
45 #endif
46 
47 #if defined(__linux)
48 #define LINUX
49 #define H3D_LINUX
50 #define H3DAPI_API
51 #ifndef HAVE_SYS_TIME_H
52 #define HAVE_SYS_TIME_H 1
53 #endif
54 #endif
55 
56 #if( defined( _WIN64 ) || defined(WIN64) )
57 // set when on 64 bit Windows
58 #define H3D_WIN64
59 #define H3D_ARCH64
60 #elif( defined( _WIN32 ) || defined(WIN32) )
61 // set when on 32 bit Windows
62 #define H3D_WIN32
63 #define H3D_ARCH32
64 #endif
65 
66 #if __GNUC__
67 #if __x86_64__ || __ppc64__
68 #define H3D_ARCH64
69 #else
70 #define H3D_ARCH32
71 #endif
72 #endif
73 
74 #if( defined( H3D_WIN32 ) || defined( H3D_WIN64 ) )
75 // set when on 32 or 64 bit Windows
76 #define H3D_WINDOWS
77 #endif
78 
81 #define HAVE_XERCES
82 
85 #define HAVE_OPENAL
86 
89 /* #undef HAVE_LIBVORBIS */
90 
93 #define HAVE_LIBAUDIOFILE
94 
98 /* #undef HAVE_CG */
99 
102 /* #undef HAVE_LIBOVR */
103 
106 #define HAVE_FTGL
107 
110 /* #undef FTGL_INCLUDE_IS_UPPER */
111 
114 #define HAVE_FREETYPE
115 
117 #define HAVE_FONTCONFIG
118 
119 #ifdef WIN32
122 /* #undef HAVE_3DXWARE */
123 #endif
124 
127 #define HAVE_PYTHON
128 /* #undef HAVE_PYTHON_OSX_FRAMEWORK */
129 /* #undef HAVE_PYTHON_DEBUG_LIBRARY */
130 
134 #define HAVE_LIBCURL
135 
140 /* #undef HAVE_SPIDERMONKEY */
141 
142 #ifdef H3D_WINDOWS
145 /* #undef HAVE_DSHOW */
146 #endif
147 
150 /* #undef HAVE_SIXENSE */
151 
154 #define HAVE_FFMPEG
155 
158 /* #undef HAVE_VIRTUAL_HAND_SDK */
159 
161 #define HAVE_GLUT
162 
164 /* #undef HAVE_OPENEXR */
165 
167 #ifdef H3D_WINDOWS
168 /* #undef HAVE_NVAPI */
169 #endif
170 
172 /* #undef DISABLE_H3D_DISPLAYLIST */
173 
176 /* #undef DISABLE_FIELD_ACCESS_TYPE_CHECK */
177 
179 /* #undef H3D_FIELD_THREAD_CHECK_DEBUG */
180 
182 /* #undef H3D_FIELD_THREAD_CHECK_RELEASE */
183 
185 /* #undef USE_APPLICATION_MANAGED_ACTIVE_TEXTURE_UNIT */
186 
190 /* #undef DISABLE_PROTOTYPENODE */
191 
196 /* #undef DEPRECATE_DISPLAYLIST_EVENT_COLLECT */
197 
198 
199 
200 #define XML_USE_WIN32_TRANSCODER
201 #define XML_USE_INMEM_MESSAGELOADER
202 #define XML_USE_NETACCESSOR_WINSOCK
203 
204 #ifdef WIN32
205 // define this if you are linking Xerces as a static library
206 /* #undef XML_LIBRARY */
207 // define this if you are linking ftgl as a static library
208 /* #undef FTGL_LIBRARY_STATIC */
209 // define this if you are linking GLEW as a static library
210 /* #undef GLEW_STATIC */
211 // define this if you are linking curl as a static library
212 /* #undef CURL_STATICLIB */
213 // define this if you are linking FreeGlut as a static library
214 /* #undef FREEGLUT_STATIC */
215 #endif
216 
217 // The following ifdef block is the standard way of creating macros
218 // which make exporting from a DLL simpler. All files within this DLL
219 // are compiled with the H3DAPI_EXPORTS symbol defined on the command
220 // line. this symbol should not be defined on any project that uses
221 // this DLL. This way any other project whose source files include
222 // this file see H3DAPI_API functions as being imported from a DLL,
223 // whereas this DLL sees symbols defined with this macro as being
224 // exported.
225 #if defined(WIN32) || defined(__WIN32__)
226 #include <windows.h>
227 
228 #ifdef H3DAPI_LIB
229 #define H3DAPI_API
230 #else
231 
232 #ifdef H3DAPI_EXPORTS
233 #define H3DAPI_API __declspec(dllexport)
234 #else
235 #define H3DAPI_API __declspec(dllimport)
236 #endif
237 #if defined(_MSC_VER) || defined(__BORLANDC__)
238 // disable dll-interface warnings for stl-exports
239 #pragma warning( disable: 4251 )
240 #endif
241 
242 #endif
243 #endif
244 
245 // Borland uses strnicmp.
246 #ifdef __BORLANDC__
247 #define _strnicmp strnicmp
248 #define __timeb64 timeb
249 #define _ftime64 ftime
250 #endif
251 
252 #define H3DAPI_MAJOR_VERSION 2
253 #define H3DAPI_MINOR_VERSION 4
254 #define H3DAPI_BUILD_VERSION 1
255 
256 namespace std {} // Have to define the namespace before using it.
257 
259 namespace H3D {
260 
261  using namespace std;
262 
264  void initializeH3D();
265 
267  void deinitializeH3D();
268 
271  inline bool isLittleEndian() {
272  union probe{
273  unsigned int num;
274  unsigned char bytes[sizeof(unsigned int)];
275  };
276  //initialize first member of p with unsigned 1
277  probe p = { 1U };
278  // in a big endian architecture, p.bytes[0] equals 0
279  bool little_endian = (p.bytes[0] == 1U);
280  return little_endian;
281  }
282 
283 
286  double H3DAPI_API getH3DApiVersion();
287 
288 }
289 
290 #endif
291 
292 
293 
H3D API namespace.
Definition: Anchor.h:38
void deinitializeH3D()
Deinitialize H3D API(only needed if using H3D API as a static library).
Definition: H3DApi.cpp:108
bool isLittleEndian()
Function for determining if the machine we are running on is uses little endian byte order or not.
Definition: H3DApi.h:271
double H3DAPI_API getH3DApiVersion()
Will return the version of H3DAPI as a double on the form H3DAPI_MAJOR_VERSION.H3DAPI_MINOR_VERSION.
Definition: H3DApi.cpp:122
void initializeH3D()
Initialize H3D API(only needed if using H3D API as a static library).
Definition: H3DApi.cpp:62