root/juggler/tags/1.0.7/vjConfig.h

Revision 8789, 4.5 kB (checked in by patrickh, 7 years ago)

Copyright update.

  • 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 /* extern HINSTANCE g_hInst = NULL; */
74 #endif   /* WIN32 */
75
76
77 /* Common C++ includes. */
78 /* Put here for pre-compiled headers. */
79 #ifdef __cplusplus
80 #include <iostream>
81 #include <iomanip>
82 #include <fstream>
83 #include <vector>
84 #include <map>
85 #include <string>
86 #include <algorithm>
87 #include <math.h>
88
89 //: Linear Interpolation
90 inline void VJ_LERP( float& result, const float& lerp, const float& a,
91                   const float& b )
92 {
93     float size = b - a;
94     result = a + (size * lerp);
95 }
96
97 template <typename DataType>
98 bool vjIsEqual (const DataType& a, const DataType& b, const DataType& tolerance)
99 {
100    return fabs(a - b) <= tolerance;
101 }
102
103 /* #include <Kernel/vjDebug.h> */
104 #endif   /* __cplusplus */
105
106 #ifdef HAVE_UNISTD_H
107 #include <unistd.h>
108 #endif
109
110 #ifdef HAVE_STRINGS_H
111 #include <strings.h>
112 #endif
113
114 /* --- Macros ---- */
115
116 /* Define this macro to replace calls to sleep(3) if it is not avialable. */
117 #ifndef HAVE_SLEEP
118 #   define sleep(x) (Sleep(x * 1000))        /* Win32-specific */
119 #endif
120
121 /* Define this macro to replace calls to usleep(3) if it is not avialable. */
122 #ifndef HAVE_USLEEP
123 #   define usleep(x) (Sleep(x / 1000))       /* Win32-specific */
124 #endif
125
126 #ifndef HAVE_SINF
127 #   define sinf(x) ((float) sin(x))
128 #endif
129
130 #ifndef HAVE_ASINF
131 #   define asinf(x) ((float) asin(x))
132 #endif
133
134 #ifndef HAVE_COSF
135 #   define cosf(x) ((float) cos(x))
136 #endif
137
138 #ifndef HAVE_ACOSF
139 #   define acosf(x) ((float) acos(x))
140 #endif
141
142 #ifndef HAVE_ATAN2F
143 #   define atan2f(x, y) ((float) atan2(x, y))
144 #endif
145
146 #ifndef HAVE_SQRTF
147 #   define sqrtf(x) ((float) sqrt(x))
148 #endif
149
150 #ifndef HAVE_FABSF
151 #   define fabsf(x) ((float) fabs(x))
152 #endif
153
154 #define VJ_EPS 1e-8
155 #define VJ_DEG2RAD(x) (x * 0.01745329252f) /* M_PI / 180.0 */
156 #define VJ_RAD2DEG(x) (x * 57.2957795131f) /* 180.0 / M_PI */
157 #define VJ_ZERO_CLAMP(x) ((fabs(x) < VJ_EPS)? 0.0f : x)
158 #define VJ_IS_ZERO(x) (fabs(x) < VJ_EPS)
159 #define VJ_CLAMP(x,y) ((x>y)? y : x)
160 #define VJ_MIN2(x,y) ((x>y)? y : x)
161 #define VJ_MIN3(x,y,z) VJ_MIN2(VJ_MIN2(x,y),z)
162 #define VJ_MIN4(w,x,y,z) VJ_MIN2(VJ_MIN2(w,x), VJ_MIN2(y,z))
163 #define VJ_MAX2(x,y) ((x>y)? x : y)
164 #define VJ_MAX3(x,y,z) VJ_MAX2(VJ_MAX2(x,y),z)
165 #define VJ_MAX4(w,x,y,z) VJ_MAX2(VJ_MAX2(w,x),VJ_MAX2(y,z))
166
167
168 #endif   /* _VJ_CONFIG_H_ */
Note: See TracBrowser for help on using the browser.