TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
grcarlight.h
Go to the documentation of this file.
1/***************************************************************************
2
3 file : grcarlight.h
4 created : Sun Oct 26 15:15:11 CET 2003
5 copyright : (C) 2003 by Christophe Guionneau
6 version : $Id$
7
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
23
24#ifndef _GRCARLIGHT_H_
25#define _GRCARLIGHT_H_
26
27class ssgVtxTableCarlight : public ssgVtxTable
28{
29protected:
30 int on ;
31 float size;
32 sgVec3 pos;
33 double factor;
34
35 virtual void copy_from ( ssgVtxTableCarlight *src, int clone_flags ) ;
36public:
37 virtual ssgBase *clone ( int clone_flags = 0 ) ;
39 ssgVtxTableCarlight ( ssgVertexArray *vtx,
40 double s, sgVec3 p);
41 int setSize (double s) { size=s ; return 0; }
42 void setOnOff (int s) { on=s ; }
43 int isOnOff () { return(on) ; }
44 sgVec3 * getPos() { return(&pos);}
45 void setFactor(double f){factor=f;}
46
47 void draw_geometry();
48
49
50 virtual void drawHighlight ( sgVec4 colour ){ssgVtxTable::drawHighlight(colour);}
51 virtual void drawHighlight ( sgVec4 colour, int i ){ssgVtxTable::drawHighlight(colour,i);}
52
53 virtual void pick ( int baseName ) { ssgVtxTable::pick(baseName);}
54 virtual void transform ( const sgMat4 m ) { ssgVtxTable::transform(m);}
55
56 virtual void setVertices ( ssgVertexArray *vl ) { ssgVtxTable::setVertices(vl);}
57 virtual void setNormals ( ssgNormalArray *nl ) { ssgVtxTable::setNormals(nl);}
58 virtual void setTexCoords ( ssgTexCoordArray *tl ) { ssgVtxTable::setTexCoords(tl);}
59 virtual void setColours ( ssgColourArray *cl ) { ssgVtxTable::setColours(cl);}
60
61 int getNumVertices () { return vertices -> getNum () ; }
62 int getNumNormals () { return normals -> getNum () ; }
63 int getNumColours () { return colours -> getNum () ; }
64 int getNumTexCoords () { return texcoords -> getNum () ; }
65 int getNumTriangles () { return ssgVtxTable::getNumTriangles();}
66 void getTriangle ( int n, short *v1, short *v2, short *v3 ) { ssgVtxTable::getTriangle(n,v1,v2,v3);}
67 int getNumLines () {return ssgVtxTable::getNumLines();}
68 void getLine ( int n, short *v1, short *v2 ) { ssgVtxTable::getLine(n,v1,v2);}
69
70
71 virtual ~ssgVtxTableCarlight (void);
72
73 virtual const char *getTypeName(void) { return ssgVtxTable::getTypeName();}
74
75 virtual int load ( FILE *fd ) {return ssgVtxTable::load(fd);}
76 virtual int save ( FILE *fd ) {return ssgVtxTable::save(fd);}
77
78
79};
80
81#define MAX_NUMBER_LIGHT 4+4+4+2
82/*
83 4 front
84 4 rear
85 4 break
86 2 reverse
87 */
88#define LIGHT_TYPE_FRONT 1
89#define LIGHT_TYPE_FRONT2 2
90#define LIGHT_TYPE_REAR 3
91#define LIGHT_TYPE_REAR2 4
92#define LIGHT_TYPE_BRAKE 5
93#define LIGHT_TYPE_BRAKE2 6
94#define LIGHT_TYPE_REVERSE 7
95#define LIGHT_NO_TYPE 0
96
105
106extern void grInitCarlight(int index); /* number of cars*/
107extern void grAddCarlight(tCarElt *car, int type, sgVec3 pos, double size);
108extern void grLinkCarlights(tCarElt *car);
109
110extern void grUpdateCarlight(tCarElt *car, class cGrPerspCamera *curCam, int dispflag);
111extern void grShudownCarlight(void);
112
113
114#endif /* _GRCARLIGHT_H_ */
static Point p[4]
Definition Convex.cpp:54
struct CarElt tCarElt
Car structure (tCarElt).
virtual const char * getTypeName(void)
Definition grcarlight.h:73
virtual void drawHighlight(sgVec4 colour, int i)
Definition grcarlight.h:51
virtual ssgBase * clone(int clone_flags=0)
virtual void setColours(ssgColourArray *cl)
Definition grcarlight.h:59
virtual ~ssgVtxTableCarlight(void)
virtual int load(FILE *fd)
Definition grcarlight.h:75
virtual void drawHighlight(sgVec4 colour)
Definition grcarlight.h:50
void setFactor(double f)
Definition grcarlight.h:45
virtual void setVertices(ssgVertexArray *vl)
Definition grcarlight.h:56
void getLine(int n, short *v1, short *v2)
Definition grcarlight.h:68
virtual void setNormals(ssgNormalArray *nl)
Definition grcarlight.h:57
virtual void transform(const sgMat4 m)
Definition grcarlight.h:54
virtual void setTexCoords(ssgTexCoordArray *tl)
Definition grcarlight.h:58
virtual void copy_from(ssgVtxTableCarlight *src, int clone_flags)
virtual int save(FILE *fd)
Definition grcarlight.h:76
int setSize(double s)
Definition grcarlight.h:41
void getTriangle(int n, short *v1, short *v2, short *v3)
Definition grcarlight.h:66
sgVec3 * getPos()
Definition grcarlight.h:44
virtual void pick(int baseName)
Definition grcarlight.h:53
void setOnOff(int s)
Definition grcarlight.h:42
void grInitCarlight(int index)
void grAddCarlight(tCarElt *car, int type, sgVec3 pos, double size)
void grShudownCarlight(void)
void grLinkCarlights(tCarElt *car)
#define MAX_NUMBER_LIGHT
Definition grcarlight.h:81
void grUpdateCarlight(tCarElt *car, class cGrPerspCamera *curCam, int dispflag)
struct tgrCarlight_t tgrCarlight
ssgVtxTableCarlight * lightCurr[MAX_NUMBER_LIGHT]
Definition grcarlight.h:100
ssgVtxTableCarlight * lightArray[MAX_NUMBER_LIGHT]
Definition grcarlight.h:99
ssgBranch * lightAnchor
Definition grcarlight.h:103
int lightType[MAX_NUMBER_LIGHT]
Definition grcarlight.h:101