root/juggler/branches/1.0/vjConfig.h

Revision 14084, 4.5 kB (checked in by patrickh, 5 years ago)

Detect OpenGL Performer on Windows (as long as there are no spaces in the
path to the Performer installation). Deal with typedef/#define issues
relating to Performer's Win32 compatibility headers.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
2  *
3  * VR Juggler is (C) Copyright 1998, 1999, 2000, 2001, 2002
4  *   by Iowa State University
5  *
6  * Original Authors:
7  *   Allen Bierbaum, Christopher Just,
8  *   Patrick Hartling, Kevin Meinert,
9  *   Carolina Cruz-Neira, Albert Baker
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the
23  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24  * Boston, MA 02111-1307, USA.
25  *
26  * -----------------------------------------------------------------
27  * File:          $RCSfile$
28  * Date modified: $Date$
29  * Version:       $Revision$
30  * -----------------------------------------------------------------
31  *
32  *************** <auto-copyright.pl END do not edit this line> ***************/
33
34 #ifndef _VJ_CONFIG_H_
35 #define _VJ_CONFIG_H_
36 /* #pragma once */
37
38 /*
39  * ----------------------------------------------------------------------------
40  * This file (vjConfig.h) includes header files common to most, if not all,
41  * files in the VR Juggler source tree.  It must be included at the top of
42  * every .h and .cpp file before any other headers because it includes system
43  * headers.
44  * ----------------------------------------------------------------------------
45  */
46
47 /* This should always be included first. */
48 #include <vjDefines.h>
49
50 #ifdef _DEBUG
51 #   define VJ_DEBUG
52 #else
53 #   define VJ_OPT
54 #endif
55
56 #ifdef WIN32
57 /* Exclude rarely-used stuff from Windows headers */
58 #define WIN32_LEAN_AND_MEAN
59
60 /* identifier truncated to 255 characters in the debug information */
61 #pragma warning(disable:4786)
62
63 #include <windows.h>
64
65 #ifndef HAVE_STRCASECMP
66 #define strcasecmp _stricmp
67 #endif
68
69 #define M_PI   3.14159265358979323846
70 #define M_PI_2 1.57079632679489661923
71 #define M_PI_4 0.78539816339744830962
72
73 typedef int int32_t;
74 typedef __int64 int64_t;
75
76 /* extern HINSTANCE g_hInst = NULL; */
77 #endif   /* WIN32 */
78
79
80 /* Common C++ includes. */
81 /* Put here for pre-compiled headers. */
82 #ifdef __cplusplus
83 #include <iostream>
84 #include <iomanip>
85 #include <fstream>
86 #include <vector>
87 #include <map>
88 #include <string>
89 #include <algorithm>
90 #include <math.h>
91
92 //: Linear Interpolation
93 inline void VJ_LERP( float& result, const float& lerp, const float& a,
94                   const float& b )
95 {
96     float size = b - a;
97     result = a + (size * lerp);
98 }
99
100 template <typename DataType>
101 bool vjIsEqual (const DataType& a, const DataType& b, const DataType& tolerance)
102 {
103    return fabs(a - b) <= tolerance;
104 }
105
106 /* #include <Kernel/vjDebug.h> */
107 #endif   /* __cplusplus */
108
109 #ifdef HAVE_UNISTD_H
110 #include <unistd.h>
111 #endif
112
113 #ifdef HAVE_STRINGS_H
114 #include <strings.h>
115 #endif
116
117 /* --- Macros ---- */
118
119 /* Define this macro to replace calls to sleep(3) if it is not avialable. */
120 #ifndef HAVE_SLEEP
121 #   define sleep(x) (Sleep(x * 1000))        /* Win32-specific */
122 #endif
123
124 /* Define this macro to replace calls to usleep(3) if it is not avialable. */
125 #ifndef HAVE_USLEEP
126 #   define usleep(x) (Sleep(x / 1000))       /* Win32-specific */
127 #endif
128
129 #ifndef HAVE_SINF
130 #   define sinf(x) ((float) sin(x))
131 #endif
132
133 #ifndef HAVE_ASINF
134 #   define asinf(x) ((float) asin(x))
135 #endif
136
137 #ifndef HAVE_COSF
138 #   define cosf(x) ((float) cos(x))
139 #endif
140
141 #ifndef HAVE_ACOSF
142 #   define acosf(x) ((float) acos(x))
143 #endif
144
145 #ifndef HAVE_ATAN2F
146 #   define atan2f(x, y) ((float) atan2(x, y))
147 #endif
148
149 #ifndef HAVE_SQRTF
150 #   define sqrtf(x) ((float) sqrt(x))
151 #endif
152
153 #ifndef HAVE_FABSF
154 #   define fabsf(x) ((float) fabs(x))
155 #endif
156
157 #define VJ_EPS 1e-8
158 #define VJ_DEG2RAD(x) (x * 0.01745329252f) /* M_PI / 180.0 */
159 #define VJ_RAD2DEG(x) (x * 57.2957795131f) /* 180.0 / M_PI */
160 #define VJ_ZERO_CLAMP(x) ((fabs(x) < VJ_EPS)? 0.0f : x)
161 #define VJ_IS_ZERO(x) (fabs(x) < VJ_EPS)
162 #define VJ_CLAMP(x,y) ((x>y)? y : x)
163 #define VJ_MIN2(x,y) ((x>y)? y : x)
164 #define VJ_MIN3(x,y,z) VJ_MIN2(VJ_MIN2(x,y),z)
165 #define VJ_MIN4(w,x,y,z) VJ_MIN2(VJ_MIN2(w,x), VJ_MIN2(y,z))
166 #define VJ_MAX2(x,y) ((x>y)? x : y)
167 #define VJ_MAX3(x,y,z) VJ_MAX2(VJ_MAX2(x,y),z)
168 #define VJ_MAX4(w,x,y,z) VJ_MAX2(VJ_MAX2(w,x),VJ_MAX2(y,z))
169
170
171 #endif   /* _VJ_CONFIG_H_ */
Note: See TracBrowser for help on using the browser.