1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
// TYPEDEF.H : some typedefs + other settings here...
// Copyright (C) 1998 Tommi Hassinen.
// This program is free software; you can redistribute it and/or modify it
// under the terms of the license (GNU GPL) which comes with this package.
/*################################################################################################*/
#include "config.h" // this is target-dependent...
#ifndef TYPEDEF_H
#define TYPEDEF_H
/*################################################################################################*/
/* added by Robert Williams for Compaq cxx, alpha 11/28/01 */
#define __USE_STD_IOSTREAM
#include <iostream>
using namespace std;
/*################################################################################################*/
/** A template class for fixed-size arrays of three units.
STL seems to be unable to store/handle the classical fixed-size arrays,
since there is no way to define the operators...
*/
template <class TYPE1> class a3
{
public:
TYPE1 data[3];
public:
a3(void) { }
a3(const TYPE1 * p1)
{
for (int n1 = 0;n1 < 3;n1++) data[n1] = p1[n1];
}
a3(TYPE1 p1, TYPE1 p2, TYPE1 p3)
{
data[0] = p1;
data[1] = p2;
data[2] = p3;
}
~a3(void) { }
TYPE1 & operator[](int p1) const
{
return (TYPE1 &) data[p1];
}
friend ostream & operator<<(ostream & p1, const a3<TYPE1> & p2)
{
p1 << "x = " << p2.data[0] << ", y = " << p2.data[1] << ", z = " << p2.data[2];
return p1;
}
};
/*################################################################################################*/
typedef int i32s;
typedef unsigned int i32u;
typedef double f64;
typedef double f64_a3[3]; // a classical fixed-size array...
typedef double f64_a4[4]; // a classical fixed-size array...
typedef a3<double> a3_f64; // a fixed-size array for STL...
/*################################################################################################*/
// currently we need GLUT in all graphics, because we use it to print some bitmap characters...
// it would be possible to make separate text output functions for TARGET2/TARGET3, but why bother???
#ifndef TARGET1
#include <GL/glut.h> // include GL stuff in TARGET2 and TARGET3!
typedef GLint iGLs;
typedef GLuint iGLu;
typedef GLfloat fGL;
typedef GLfloat fGL_a3[3]; // a classical fixed-size array...
typedef GLfloat fGL_a4[4]; // a classical fixed-size array...
typedef a3<GLfloat> a3_fGL; // a fixed-size array for STL...
#else // in TARGET1 just define basic types...
typedef int iGLs;
typedef unsigned int iGLu;
typedef float fGL;
typedef float fGL_a3[3]; // a classical fixed-size array...
typedef float fGL_a4[4]; // a classical fixed-size array...
typedef a3<float> a3_fGL; // a fixed-size array for STL...
#endif
/*################################################################################################*/
typedef fGL ValueFunction(fGL *, void *, fGL *);
typedef void ColorFunction(fGL, fGL, fGL *);
/*################################################################################################*/
#endif // TYPEDEF_H
// eof
|