Page principale | Liste des namespaces | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Membres des namespaces | Composants | Déclarations

ExCMeshWaterDisqueEffect.cpp

Aller à la documentation de ce fichier.
00001 /*
00002  * ExNihilo 3D Engine
00003  * 
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  *
00018  * Please read AUTHORS file !!!
00019  * 
00020 
00021  *
00022  */
00023 
00024 #include "ExCMeshWaterDisqueEffect.h"
00025 
00026 ExCMeshWaterDisqueEffect::ExCMeshWaterDisqueEffect()
00027 {
00028 Guard(ExCMeshWaterDisqueEffect::ExCMeshWaterDisqueEffect())
00029         SetName("ExCMeshWaterDisqueEffect");
00030         SetType(typeid(this).name());
00031 
00032         m_Rayon=20;
00033         m_NumberFace=16;
00034         m_Rotation=0;
00035         m_NumberLayer=3;
00036         m_SizeBetwenLayer=0.001;
00037         m_Texture1="wave.dds";
00038         m_TextureMouvingVec.SetValue(0,-0.0001);
00039         m_TextureNextMouvingVec.SetValue(0,-0.00005);
00040         m_Color.SetValue(0.9,0.0,0.0f);
00041 UnGuard
00042 }
00043 
00044 ExCMeshWaterDisqueEffect::~ExCMeshWaterDisqueEffect()
00045 {
00046 Guard(ExCMeshWaterDisqueEffect::~ExCMeshWaterDisqueEffect())
00047 UnGuard
00048 }
00049 
00050 void ExCMeshWaterDisqueEffect::Draw(void)
00051 {
00052 Guard(void ExCMeshWaterDisqueEffect::Draw(void))
00053 if(!m_Visible)return;
00054 
00055         ExCVec3D        Vec;
00056         glPushAttrib(GL_ALL_ATTRIB_BITS);
00057         glPushMatrix();
00058         glTranslatef(0,1000,0);
00059         glDisable(GL_LIGHTING);
00060         glColor3f(m_Color.GetX(),m_Color.GetY(),m_Color.GetZ());
00061         glEnable(GL_TEXTURE_2D);
00062 
00063         for(int j=0;j<m_NumberLayer+0;j++)
00064         {
00065 
00066                 glMatrixMode(GL_TEXTURE);
00067                 glTranslatef((m_TextureMouvingVec.GetX()+(j*m_TextureNextMouvingVec.GetX()))*glutGet(GLUT_ELAPSED_TIME)
00068                         ,(m_TextureMouvingVec.GetY()+(j*m_TextureNextMouvingVec.GetY()))*glutGet(GLUT_ELAPSED_TIME),0.0f);
00069                 glRotatef(45,0,0,1);
00070                 glMatrixMode(GL_MODELVIEW);     
00071         
00072                 ManagerTexture->SetCurrentObject(m_Texture1);
00073 
00074                 if(j!=0)
00075                 {
00076                         glEnable(GL_BLEND);
00077                         glBlendFunc(GL_ONE,GL_ONE);
00078                         glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
00079                 }
00080 
00081                 glBegin(GL_QUADS);
00082                 for(int i=0;i<m_NumberFace;i++)
00083                 {
00084                         glColor4f(m_Color.GetX(),m_Color.GetY(),m_Color.GetZ(),1.0f);
00085                         glTexCoord2f(1,1);glVertex3f(0,m_SizeBetwenLayer*j,0);
00086                         
00087                         glColor4f(0,0,0,0.0f);
00088                         glTexCoord2f(0,1);
00089                         Vec.SetX(Cos[(i+1)*(360/m_NumberFace)]*(m_Rayon));
00090                         Vec.SetZ(Sin[(i+1)*(360/m_NumberFace)]*(m_Rayon));
00091                         Vec.SetY(m_SizeBetwenLayer*j);
00092                         if(i==m_NumberFace-1)
00093                         {
00094                                 Vec.SetX(Cos[(0)*(360/m_NumberFace)]*(m_Rayon));
00095                                 Vec.SetZ(Sin[(0)*(360/m_NumberFace)]*(m_Rayon));
00096                         }
00097                         glVertex3fv(Vec.m_Vector);
00098 
00099                         glTexCoord2f(1,0);
00100                         Vec.SetX(Cos[(i)*(360/m_NumberFace)]*(m_Rayon));
00101                         Vec.SetZ(Sin[(i)*(360/m_NumberFace)]*(m_Rayon));
00102                         Vec.SetY(m_SizeBetwenLayer*j);
00103                         glVertex3fv(Vec.m_Vector);
00104 
00105                         glColor4f(m_Color.GetX(),m_Color.GetY(),m_Color.GetZ(),1.0f);
00106                         glTexCoord2f(0,0);glVertex3f(0,m_SizeBetwenLayer*j,0);
00107                 }
00108                 glEnd();
00109 
00110                 glMatrixMode(GL_TEXTURE);
00111                 glLoadIdentity();
00112                 glMatrixMode(GL_MODELVIEW);
00113         }
00114 
00115 
00116         glDisable(GL_TEXTURE_2D);
00117         glPopMatrix();
00118         glPopAttrib();
00119 
00120 UnGuard
00121 }
00122 
00123 bool ExCMeshWaterDisqueEffect::Load(std::string FileName)
00124 {
00125 Guard(bool ExCMeshWaterDisqueEffect::Load(std::string FileName))
00126         FileName="../Data/Mesh/"+FileName;
00127         m_NumberFace=ExNihilo::ExtractIntValueFromFile(FileName,"<NumberFace>","<#NumberFace>");
00128         m_Rayon=ExNihilo::ExtractFloatValueFromFile(FileName,"<Rayon>","<#Rayon>");
00129         m_NumberLayer=ExNihilo::ExtractIntValueFromFile(FileName,"<NumberLayer>","<#NumberLayer>");
00130         m_SizeBetwenLayer=ExNihilo::ExtractFloatValueFromFile(FileName,"<SizeBetwenLayer>","<#SizeBetwenLayer>");
00131         m_Texture1=ExNihilo::ExtracStringValueFromFile(FileName,"<Texture>","<#Texture>");
00132         m_TextureMouvingVec.SetValue(ExNihilo::ExtractFloatValueFromFile(FileName,"<TextureMouvingVecX>","<#TextureMouvingVecX>"),
00133                                                                 ExNihilo::ExtractFloatValueFromFile(FileName,"<TextureMouvingVecY>","<#TextureMouvingVecY>"));
00134         m_TextureNextMouvingVec.SetValue(ExNihilo::ExtractFloatValueFromFile(FileName,"<TextureNextMouvingVecX>","<#TextureNextMouvingVecX>"),
00135                                                                         ExNihilo::ExtractFloatValueFromFile(FileName,"<TextureNextMouvingVecY>","<#TextureNextMouvingVecY>"));
00136         m_Color.SetValue(ExNihilo::ExtractFloatValueFromFile(FileName,"<ColorR>","<#ColorR>")
00137                                         ,ExNihilo::ExtractFloatValueFromFile(FileName,"<ColorG>","<#ColorG>")
00138                                         ,ExNihilo::ExtractFloatValueFromFile(FileName,"<ColorB>","<#ColorB>"));
00139         ManagerTexture->Add(m_Texture1);
00140 UnGuard
00141 }

Généré le Tue Oct 28 12:43:31 2003 pour ExNihilo par doxygen 1.3.4