Main Page   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

ExManagerOutput.cpp

Go to the documentation of this file.
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         glCullFace(GL_BACK);
00068         glEnable(GL_CULL_FACE);
00069         //glEnable(GL_LIGHTING);
00070         glPolygonMode(GL_FRONT,GL_FILL);
00071         glEnable(GL_COLOR_MATERIAL );
00072         glEnable(GL_DEPTH_TEST);
00073         glEnable(GL_AUTO_NORMAL);
00074         glEnable(GL_NORMALIZE);
00075         glEnable(GL_ALPHA_TEST);
00076         //glLightModelf(GL_LIGHT_MODEL_TWO_SIDE,GL_FALSE);
00077         glLineWidth(1.5);
00078         glRenderMode(GL_RENDER);
00079 UnGuard
00080 }
00081 
00082 
00083 
00084 void ExManagerOutput::Reshape(int w,int h)
00085 {
00086 Guard(ExManagerOutput::Reshape(int w,int h))
00087         ManagerWindow->SetResolution(w,h);
00088         glMatrixMode(GL_PROJECTION);
00089         glLoadIdentity();
00090         glViewport(0,0,ManagerWindow->GetResolutionX(),ManagerWindow->GetResolutionY());
00091         gluPerspective(ManagerCamera->GetCurrentObject()->GetZoom(),
00092                 (1.0f *ManagerWindow->GetResolutionX() / ManagerWindow->GetResolutionY()),
00093                 ManagerCamera->GetCurrentObject()->GetClipNear(),
00094                 ManagerCamera->GetCurrentObject()->GetClipFar());
00095         glMatrixMode(GL_MODELVIEW);
00096         glLoadIdentity();
00097         ManagerCamera->GetCurrentObject()->Draw();
00098 UnGuard
00099 }
00100 
00101 void ExManagerOutput::DrawScene(void)
00102 {
00103 Guard(ExManagerOutput::DrawScene(void))
00104         //glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
00105         glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
00106     ManagerCommand->ApplyAction();
00107         //-------------------------------------------
00108         //Draw 3d Object
00109         //-------------------------------------------
00110         ManagerCamera->Draw();
00111         //if(ManagerWindow->GetMotionBlurState()){ManagerWindow->MotionBlur();}
00112     ManagerMap->Draw();
00113         ManagerModel->Draw();
00114         ManagerGizmo->Draw();
00115         ManagerParticuleSystem->Draw();
00116     //ManagerLight->Draw();
00117         if(ManagerWindow->GetGrilleState()){glCallList(GRILLE);}
00118         //-------------------------------------------
00119         //Draw 2d Object
00120         //-------------------------------------------
00121         if(ManagerInterface->GetStatus()){ManagerInterface->Draw();}
00122         if(ManagerWindow->GetFpsState())ManagerWindow->ShowFps();
00123         ManagerNetwork->Draw();
00124         ManagerSpirit->Draw();
00125         //ManagerWindow->Specialeffect();
00126         ManagerMenu->Draw();
00127         ManagerConsole->Draw();
00128         glFlush();
00129         glutSwapBuffers();
00130 UnGuard
00131 }
00132 

Generated on Tue Dec 10 18:20:07 2002 for ExNihilo by doxygen1.3-rc1