00001 /**************************************************************************** 00002 00003 This file is part of the GLC-lib library. 00004 Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net) 00005 http://glc-lib.sourceforge.net 00006 00007 GLC-lib is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 GLC-lib is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with GLC-lib; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 00021 *****************************************************************************/ 00023 00024 #include "glc_renderstatistics.h" 00025 00026 // Static variables initialisation 00027 bool GLC_RenderStatistics::m_IsActivated= false; 00028 unsigned int GLC_RenderStatistics::m_LastRenderGeometryCount= 0; 00029 unsigned long GLC_RenderStatistics::m_LastRenderPolygonCount= 0; 00030 00031 GLC_RenderStatistics::GLC_RenderStatistics() 00032 { 00033 00034 00035 } 00036 00037 GLC_RenderStatistics::~GLC_RenderStatistics() 00038 { 00039 00040 } 00041 00043 // Get methods 00045 bool GLC_RenderStatistics::activated() 00046 { 00047 return m_IsActivated; 00048 } 00049 00050 unsigned int GLC_RenderStatistics::bodyCount() 00051 { 00052 return m_LastRenderGeometryCount; 00053 } 00054 00055 unsigned long GLC_RenderStatistics::triangleCount() 00056 { 00057 return m_LastRenderPolygonCount; 00058 } 00059 00061 // Set methods 00063 void GLC_RenderStatistics::setActivationFlag(bool flag) 00064 { 00065 m_IsActivated= flag; 00066 } 00067 00068 void GLC_RenderStatistics::reset() 00069 { 00070 m_LastRenderGeometryCount= 0; 00071 m_LastRenderPolygonCount= 0; 00072 } 00073 00074 void GLC_RenderStatistics::addBodies(unsigned int bodies) 00075 { 00076 if (m_IsActivated) 00077 { 00078 m_LastRenderGeometryCount+= bodies; 00079 } 00080 } 00081 00082 void GLC_RenderStatistics::addTriangles(unsigned int triangles) 00083 { 00084 if (m_IsActivated) 00085 { 00086 m_LastRenderPolygonCount+= triangles; 00087 } 00088 }