root/juggler/tags/1.0.2/vjConfig.h
| Revision 5820, 4.3 kB (checked in by anonymous, 7 years ago) | |
|---|---|
| |
| 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 | /* #include <Kernel/vjDebug.h> */ |
| 96 | #endif /* __cplusplus */ |
| 97 | |
| 98 | #ifdef HAVE_UNISTD_H |
| 99 | #include <unistd.h> |
| 100 | #endif |
| 101 | |
| 102 | #ifdef HAVE_STRINGS_H |
| 103 | #include <strings.h> |
| 104 | #endif |
| 105 | |
| 106 | /* --- Macros ---- */ |
| 107 | |
| 108 | /* Define this macro to replace calls to sleep(3) if it is not avialable. */ |
| 109 | #ifndef HAVE_SLEEP |
| 110 | # define sleep(x) (Sleep(x * 1000)) /* Win32-specific */ |
| 111 | #endif |
| 112 | |
| 113 | /* Define this macro to replace calls to usleep(3) if it is not avialable. */ |
| 114 | #ifndef HAVE_USLEEP |
| 115 | # define usleep(x) (Sleep(x / 1000)) /* Win32-specific */ |
| 116 | #endif |
| 117 | |
| 118 | #ifndef HAVE_SINF |
| 119 | # define sinf(x) ((float) sin(x)) |
| 120 | #endif |
| 121 | |
| 122 | #ifndef HAVE_ASINF |
| 123 | # define asinf(x) ((float) asin(x)) |
| 124 | #endif |
| 125 | |
| 126 | #ifndef HAVE_COSF |
| 127 | # define cosf(x) ((float) cos(x)) |
| 128 | #endif |
| 129 | |
| 130 | #ifndef HAVE_ACOSF |
| 131 | # define acosf(x) ((float) acos(x)) |
| 132 | #endif |
| 133 | |
| 134 | #ifndef HAVE_ATAN2F |
| 135 | # define atan2f(x, y) ((float) atan2(x, y)) |
| 136 | #endif |
| 137 | |
| 138 | #ifndef HAVE_SQRTF |
| 139 | # define sqrtf(x) ((float) sqrt(x)) |
| 140 | #endif |
| 141 | |
| 142 | #ifndef HAVE_FABSF |
| 143 | # define fabsf(x) ((float) fabs(x)) |
| 144 | #endif |
| 145 | |
| 146 | #define VJ_EPS 1e-8 |
| 147 | #define VJ_DEG2RAD(x) (x * 0.01745329252f) /* M_PI / 180.0 */ |
| 148 | #define VJ_RAD2DEG(x) (x * 57.2957795131f) /* 180.0 / M_PI */ |
| 149 | #define VJ_ZERO_CLAMP(x) ((fabs(x) < VJ_EPS)? 0.0f : x) |
| 150 | #define VJ_IS_ZERO(x) (fabs(x) < VJ_EPS) |
| 151 | #define VJ_CLAMP(x,y) ((x>y)? y : x) |
| 152 | #define VJ_MIN2(x,y) ((x>y)? y : x) |
| 153 | #define VJ_MIN3(x,y,z) VJ_MIN2(VJ_MIN2(x,y),z) |
| 154 | #define VJ_MIN4(w,x,y,z) VJ_MIN2(VJ_MIN2(w,x), VJ_MIN2(y,z)) |
| 155 | #define VJ_MAX2(x,y) ((x>y)? x : y) |
| 156 | #define VJ_MAX3(x,y,z) VJ_MAX2(VJ_MAX2(x,y),z) |
| 157 | #define VJ_MAX4(w,x,y,z) VJ_MAX2(VJ_MAX2(w,x),VJ_MAX2(y,z)) |
| 158 | |
| 159 | |
| 160 | #endif /* _VJ_CONFIG_H_ */ |
Note: See TracBrowser for help on using the browser.
