00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef __SGL_STATS_HPP
00027 #define __SGL_STATS_HPP
00028
00029 #include <sgl.h>
00030
00031
00032
00033
00034
00035 class sglTexture;
00036
00040 class SGL_DLL_API sglStats
00041 {
00042 public:
00044 enum PrimEnum {ePOINTS,
00045 eLINES,
00046 eLINESTRIPS,
00047 eTRIS,
00048 eQUADS,
00049 eTRISTRIPS,
00050 eTRIFANS,
00051 eQUADSTRIPS,
00052 ePOLYS,
00053 eINDEXED_POINTS,
00054 eINDEXED_LINES,
00055 eINDEXED_LINESTRIPS,
00056 eINDEXED_TRIS,
00057 eINDEXED_QUADS,
00058 eINDEXED_TRISTRIPS,
00059 eINDEXED_TRIFANS,
00060 eINDEXED_QUADSTRIPS,
00061 eINDEXED_POLYS,
00062 eMONO_INDEXED_POINTS,
00063 eMONO_INDEXED_LINES,
00064 eMONO_INDEXED_LINESTRIPS,
00065 eMONO_INDEXED_TRIS,
00066 eMONO_INDEXED_QUADS,
00067 eMONO_INDEXED_TRISTRIPS,
00068 eMONO_INDEXED_TRIFANS,
00069 eMONO_INDEXED_QUADSTRIPS,
00070 eMONO_INDEXED_POLYS,
00071 eINTERLEAVED_POINTS,
00072 eINTERLEAVED_LINES,
00073 eINTERLEAVED_LINESTRIPS,
00074 eINTERLEAVED_LINELOOPS,
00075 eINTERLEAVED_TRIS,
00076 eINTERLEAVED_QUADS,
00077 eINTERLEAVED_TRISTRIPS,
00078 eINTERLEAVED_TRIFANS,
00079 eINTERLEAVED_QUADSTRIPS,
00080 eINTERLEAVED_POLYS,
00081 eBEZIER_CURVES,
00082 eBEZIER_SURFACES,
00083 eNUM_PRIM_TYPES};
00084
00085 public:
00087 sglStats() { reset(); }
00088
00090 ~sglStats() {};
00091
00093 sglStats(const sglStats &);
00094
00096 sglStats& operator=(const sglStats &);
00097
00099 sglStats& operator+=(const sglStats &);
00100
00102 void reset();
00103
00105 void average();
00106
00108 void addNumLights(float num_used, float num_desired)
00109 {
00110 m_num_lights_used += num_used;
00111 m_num_lights_desired += num_desired;
00112 }
00114 float getNumLightsUsed() const { return m_num_lights_used; }
00116 float getNumLightsDesired() const { return m_num_lights_desired; }
00117
00119 void addFrames(float num) { m_frames += num; m_textures.clear(); }
00121 float getFrames() const { return m_frames; }
00122
00124 void addTransforms(float num) { m_transforms += num; }
00126 float getTransforms() const { return m_transforms; }
00127
00129 void addStateChanges(float num) { m_state_changes += num; }
00131 float getStateChanges() const { return m_state_changes; }
00132
00134 void addTotalGSets(float num) { m_total_gsets += num; }
00136 float getTotalGSets() const { return m_total_gsets; }
00137
00139 void addDListedGSets(float num) { m_dlisted_gsets += num; }
00141 float getDListedGSets() const { return m_dlisted_gsets; }
00142
00144 void addTransparencyEnabledGSets(float num)
00145 { m_transparency_enabled_gsets += num; }
00147 float getTransparencyEnabledGSets() const
00148 { return m_transparency_enabled_gsets; }
00149
00151 void addOcclusionEnabledGSets(float num)
00152 { m_occlusion_enabled_gsets += num; }
00154 float getOcclusionEnabledGSets() const
00155 { return m_occlusion_enabled_gsets; }
00156
00158 void addOccludedGSets(float num) { m_occluded_gsets += num; }
00160 float getOccludedGSets() const { return m_occluded_gsets; }
00161
00163 void addLitGSets(float num) { m_lit_gsets += num; }
00165 float getLitGSets() const { return m_lit_gsets; }
00166
00168 void addTexturedGSets(float num) { m_textured_gsets += num; }
00170 float getTexturedGSets() const { return m_textured_gsets; }
00171
00173 void addTexture(const sglTexture *tex);
00175 float getNumTextures() { return m_num_textures; }
00177 float getIdealTextureMemory() { return m_ideal_tex_mem; }
00179 float getLikelyTextureMemory() { return m_likely_tex_mem; }
00180
00182 void addText(float num) { m_text += num; }
00184 float getText() const { return m_text; }
00185
00187 void addGSets(PrimEnum type, float num) { m_gsets[type] += num; }
00189 float getGSets(PrimEnum type) { return m_gsets[type]; }
00190
00192 void addPrims(PrimEnum type, float num) { m_prims[type] += num; }
00194 float getPrims(PrimEnum type) { return m_prims[type]; }
00195
00197 void addVertices(PrimEnum type, float num) { m_vertices[type] += num; }
00199 float getVertices(PrimEnum type) { return m_vertices[type]; }
00200
00202 void addTriangles(PrimEnum type, float num) { m_triangles[type] += num; }
00204 float getTriangles(PrimEnum type) { return m_triangles[type]; }
00205
00207 void printInfo(ostream &ostrm, const char *indent_string) const;
00208
00209 public:
00210 static const char* s_geometry_type_names[];
00211
00212 private:
00213 float m_frames;
00214 float m_transforms;
00215 float m_state_changes;
00216 float m_total_gsets;
00217 float m_dlisted_gsets;
00218 float m_transparency_enabled_gsets;
00219 float m_occlusion_enabled_gsets;
00220 float m_occluded_gsets;
00221 float m_lit_gsets;
00222 float m_textured_gsets;
00223 vector<const sglTexture*> m_textures;
00224 float m_num_textures;
00225 float m_ideal_tex_mem;
00226 float m_likely_tex_mem;
00227 float m_text;
00228 float m_gsets[eNUM_PRIM_TYPES];
00229 float m_prims[eNUM_PRIM_TYPES];
00230 float m_vertices[eNUM_PRIM_TYPES];
00231 float m_triangles[eNUM_PRIM_TYPES];
00232
00233 float m_num_lights_used;
00234 float m_num_lights_desired;
00235 };
00236
00237 #endif