UNIX portability fixes; disabled Quaternion friend templates

pull/3/head
Chris Laurel 2001-05-02 18:06:32 +00:00
parent e49c6743fa
commit 06f699e31f
3 changed files with 12 additions and 1 deletions

View File

@ -17,6 +17,9 @@
#include "vecmath.h"
#if 0
// Forward declarations needed to make friend templates work . . .
// Disabled until I can get this to work on every compiler.
template<class T> class Quaternion;
template<class T> Quaternion<T> operator+(Quaternion<T>, Quaternion<T>);
@ -28,6 +31,7 @@ template<class T> bool operator==(Quaternion<T>, Quaternion<T>);
template<class T> bool operator!=(Quaternion<T>, Quaternion<T>);
template<class T> T real(Quaternion<T>);
template<class T> Vector3<T> imag(Quaternion<T>);
#endif
template<class T> class Quaternion
{
@ -67,6 +71,8 @@ public:
bool isReal() const;
T normalize();
#if 0
// This code is disabled until I can
#ifndef BROKEN_FRIEND_TEMPLATES
// This just rocks . . . MSVC 6.0 doesn't parse this correctly,
// so template friend functions need to be declared in the standard
@ -94,8 +100,11 @@ public:
friend T real(Quaternion<T>);
friend Vector3<T> imag(Quaternion<T>);
#endif // BROKEN_FRIEND_TEMPLATES
#endif
// Until friend templates are working . . .
// private:
T w, x, y, z;
};

View File

@ -10,6 +10,7 @@
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#define GL_GLEXT_PROTOTYPES
#include "gl.h"
#include "glext.h"
#include "regcombine.h"

View File

@ -229,8 +229,9 @@ void SphereMesh::generateNormals()
for (i = 0; i <= nSlices; i++)
{
int vertex = i;
int j;
faceCounts[vertex] = nSlices;
for (int j = 0; j < nSlices; j++)
for (j = 0; j < nSlices; j++)
{
int face = j;
normals[vertex * 3] += faceNormals[face].x;