class plane
{
public:
float a,b,c,d;
point n;
plane();
// constructors from a,b,c,d
plane(float,float,float,float);
void create(float,float,float,float);
// constructors from 3 passing points
plane(point,point,point);
void create(point,point,point);
void negate();
// point comes in xyz. The result indicates the distance
// to the plane's oriented surface from the point. Values
// >0 mean point outside (in the normal side) of the plane.
// <0 mean inside, and =0 mean point on surface.
double testpoint (point);
// line comes in the form of passing point + director vector.
// result is 0 if line parallel to plane. !0 if colliding,
// and then the third param returns the interesction point
double testline(point,point,point &);
int magicnumber (point);
int testtri (point,point,point);
point getpointfromplane();
double evalxy(double,double);
double evalxz(double,double);
double evalyz(double,double);
void operator=(plane); // copy
~plane();
};
#endif
#ifndef _POINT_INC
#define _POINT_INC
/*
Written by DSC aprox. 1996
1.7.98 Translation into good-looking C++
*/
#include "text.h"
class point
{
public:
double x,y,z; /* oops... this makes rendering faster! */
point();
point(double,double,double);
point(text &);
point(point &);
void create(double,double,double);
void load(text &);
point operator+(point); // addition
point operator-(point); // substraction
int operator==(point); // comparison
int operator!=(point); // negated comparison
void operator=(point); // copy
point operator*(double); // scaling
point operator/(double); // inv. scaling
double operator*(point); // dot product
point operator^(point); // cross product
point interpolate(point,double,point,double);
double modulo();
double modulosq();
double distance(point);
double distanceman(point);
double distancemanxz(point);
void normalize();
void negate();
int into(point, point);
float distancePointLine(point,point);//distance from point this to line ab
void rotatex(double);
void rotatey(double);
void rotatey(float,float); //rotatey passing sin(ang) and cos(ang) values
void rotatez(double);
bool infrustum(point,double,double); // viewer,yaw of viewer,aperture,caller is point to test
~point();
};
#endif
class texmanager
{
public:
int numtextures;
int allocatedmemory;
texture *texdata;
unsigned int *translationtable;
int *available;
int *type;
texmanager();
int load(char *);
void usetexture(int);
void removetexture(int);
~texmanager();
};
#endif
class text
{
char *data;
unsigned int sl;
unsigned int size;
public:
text();
text(char*);
void create(char *);
char *getword();
char *getcommaword();
int getint();
double getfloat();
int countword(char *);
int countwordfromhere(char *);
int countchar(char);
void reset();
void destroy();
void goback();
void seek(char *);
int eof();
~text();
};
#endif
lass texture
{
public:
char *name;
unsigned int ident;
int sizex,sizey;
int depth; // in bytes per pixel
bool alpha;
texture();
int loadtex(char *,int);
int loadtga(char *,int);
void use();
~texture();
};
#endif