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

ExManagerOutput.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  * $Id: ExManagerOutput.cpp,v 1.23 2002/11/24 11:58:58 data Exp $
00021  *
00022  */
00023 
00024 #include "ExManagerOutput.h"
00025 
00026 bool ExManagerOutput::m_flag = false; 
00027 ExManagerOutput* ExManagerOutput::m_instance = NULL; 
00028 
00029 ExManagerOutput* ExManagerOutput::CreateSingleton(void){
00030 Guard(ExManagerOutput* ExManagerOutput::CreateSingleton(void))
00031         if(!m_flag)
00032         {
00033                 m_flag = true; // We are creating the error log now, so set flag to true
00034                 m_instance = new ExManagerOutput; // Create the error log
00035         }else
00036         {
00037                 std::cout<<"Error singleton already created"<<std::endl;
00038         }
00039         return m_instance; 
00040 UnGuard
00041 }
00042 
00043 ExManagerOutput::ExManagerOutput(void)
00044 {
00045 Guard(ExManagerOutput::ExManagerOutput(void))
00046 UnGuard
00047 }
00048 
00049 ExManagerOutput::~ExManagerOutput(void)
00050 {
00051 Guard(ExManagerOutput::~ExManagerOutput(void))
00052 UnGuard
00053 }
00054 
00055 void ExManagerOutput::Reset(void)
00056 {
00057         Init();
00058 }
00059 
00060 void ExManagerOutput::Init(void)
00061 {
00062 Guard(ExManagerOutput::Init(void))
00063         glShadeModel(GL_SMOOTH);                                                        // Enable Smooth Shading
00064         glClearColor(0.0f, 0.0f, 0.0f, 0.5f);                           // Black Background
00065         glClearDepth(1.0f);                                                                     // Depth Buffer Setup
00066         glDepthFunc(GL_LEQUAL);                                                         // The Type Of Depth Testing To Do
00067         //glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
00068         glCullFace(GL_BACK);
00069         glEnable(GL_CULL_FACE);
00070         //glEnable(GL_LIGHTING);
00071         glPolygonMode(GL_FRONT,GL_FILL);
00072         glEnable(GL_COLOR_MATERIAL );
00073         glEnable(GL_DEPTH_TEST);
00074         //glEnable(GL_AUTO_NORMAL);
00075         //glEnable(GL_NORMALIZE);
00076         glEnable(GL_ALPHA_TEST);
00077         //glLightModelf(GL_LIGHT_MODEL_TWO_SIDE,GL_FALSE);
00078         glLineWidth(1.5);
00079         glRenderMode(GL_RENDER);
00080 
00081 
00082 
00083 UnGuard
00084 }
00085 
00086 
00087 
00088 void ExManagerOutput::Reshape(int w,int h)
00089 {
00090 Guard(ExManagerOutput::Reshape(int w,int h))
00091         ManagerWindow->SetResolution(w,h);
00092         glMatrixMode(GL_PROJECTION);
00093         glLoadIdentity();
00094         glViewport(0,0,ManagerWindow->GetResolutionX(),ManagerWindow->GetResolutionY());
00095         gluPerspective(ManagerCamera->GetCurrentObject()->GetZoom(),
00096                 (1.0f *ManagerWindow->GetResolutionX() / ManagerWindow->GetResolutionY()),
00097                 ManagerCamera->GetCurrentObject()->GetClipNear(),
00098                 ManagerCamera->GetCurrentObject()->GetClipFar());
00099         glMatrixMode(GL_MODELVIEW);
00100         glLoadIdentity();
00101         ManagerCamera->GetCurrentObject()->Draw();
00102 UnGuard
00103 }
00104 
00105 void ExManagerOutput::DrawScene(void)
00106 {
00107 Guard(ExManagerOutput::DrawScene(void))
00108         //std::cout<<"Drawscene"<<std::endl;
00109         //glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
00110         glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);       //Clear screen
00111         //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
00112         ManagerCommand->ApplyAction();                                          //Apply all action for this frame
00113         ManagerAnimation->Draw();                                                       //Apply all mouvement to object
00114         //ManagerCollision->ResolveCollision();                         //Check for collision and modify object force
00115         //-------------------------------------------
00116         //Draw 3d Object
00117         //-------------------------------------------
00118         ManagerCamera->Draw();
00119     ManagerSpecialEffect->BeforeDraw();
00120         ManagerCollision->Clear();
00121     
00122         
00123         ManagerMap->Draw();
00124         ManagerModel->Draw();
00125         ManagerGizmo->Draw();
00126         ManagerPVS->Draw();
00127         ManagerParticuleSystem->Draw();
00128         ManagerLight->Draw();
00129         if(ManagerWindow->GetGrilleState()){ExNihilo::DrawGrid(250);}
00130         
00131         //-------------------------------------------
00132         //Draw 2d Object
00133         //-------------------------------------------
00134         ManagerSpecialEffect->Draw();
00135         if(ManagerInterface->GetStatus()){ManagerInterface->Draw();}
00136         if(ManagerWindow->GetFpsState())ManagerWindow->ShowFps();
00137         //ManagerVertexProgram->Draw();
00138         ManagerNetwork->Draw();
00139         ManagerSpirit->Draw();
00140         
00141         
00142 
00143         ManagerObjectWindow->Draw();
00144         ManagerLoad->Draw();
00145         ManagerConsole->Draw();
00146         glFlush();
00147         glutSwapBuffers();
00148 
00149 UnGuard
00150 }
00151 

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