root/juggler/tags/1.0.5/vjConfig.h

Revision 7539, 4.5 kB (checked in by anonymous, 7 years ago)

This commit was manufactured by cvs2svn to create tag
'RELENG_1_0_5_RELEASE'.

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