Morph-SynRJ
view efx_equa2.cxx @ 0:22de913c2d84
morph-synrj intro
| author | "Cedric Pinson <cedric.pinson@alcove.fr> <mornifle@plopbyte.net>" |
|---|---|
| date | Tue Nov 27 15:23:52 2007 +0100 (2007-11-27) |
| parents | |
| children |
line source
1 #include "efx_equa2.h"
2 #include "gl_header.h"
3 #include "cmn_intro.h"
7 void efxEquaBase_t::Draw()
8 {
9 glPushMatrix();
10 glTranslatef(position[0],position[1],position[2]);
11 float light[4];
12 light[3]=1.0;
14 int lineIndex;
15 int index;
16 int rX=resolutionX/2;
17 int rY=resolutionY/2;
18 for (int j=0;j<resolutionY;j++) {
19 lineIndex=resolutionX*j;
20 for (int i=0;i<resolutionX;i++) {
21 index=lineIndex+i;
23 if (elements[index].level>0) {
24 light[0]=219.0/255*elements[index].level;
25 light[1]=127.0/255*elements[index].level;
26 light[2]=13.0/255*elements[index].level;
27 } else {
28 light[0]=1.0;
29 light[1]=1.0;
30 light[2]=1.0;
31 }
32 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,light);
34 glPushMatrix();
35 glTranslatef((i-rX)*sizeElementX,elements[index].level,(j-rY)*sizeElementY);
36 glCallList(elements[index].meshId);
37 glPopMatrix();
38 }
39 }
40 glPopMatrix();
41 }
44 void efxEquaBase_t::SetGeometry(GLuint _id)
45 {
46 int nb=NbElements();
47 for (int i=0;i<nb;i++)
48 elements[i].SetMesh(_id);
49 }
