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_CURR_STATE_HPP
00027 #define __SGL_CURR_STATE_HPP
00028
00029 #include <sgl.h>
00030
00031 #include <sglDrawable.hpp>
00032
00033
00034
00035 struct SGL_DLL_API sglFullState
00036 {
00037 public:
00038 sglFullState()
00039 : m_statelet(sgl::s_num_statelet_types, (const sglStatelet*)NULL) {}
00040 ~sglFullState() {}
00041
00042 void clear()
00043 {
00044 for (unsigned int ii = 0; ii < sgl::s_num_statelet_types; ++ii)
00045 m_statelet[ii] = NULL;
00046 m_tex_coords = NULL;
00047 m_dlist = 0;
00048 }
00049
00050
00051 void addStats(sglStats& stats) const;
00052
00053 private:
00054 sglFullState(const sglFullState &);
00055 sglFullState& operator=(const sglFullState &);
00056
00057 public:
00058 vector<const sglStatelet*> m_statelet;
00059 const vector<sglTexCoords> *m_tex_coords;
00060 GLuint m_dlist;
00061 };
00062
00063 class SGL_DLL_API sglCurrState
00064 {
00065 public:
00066 sglCurrState()
00067 : m_point_smooth(false), m_line_smooth(false), m_multisample(false) {}
00068 ~sglCurrState() {}
00069
00070 void apply(const sglFullState *new_state);
00071 void statsApply(const sglFullState *new_state, sglStats& stats);
00072 void draw(const sglDrawable *drawable);
00073 void force(const sglFullState *new_state);
00074
00075 void checkBlend();
00076 void checkDepthMask();
00077
00078 private:
00079 void checkPointSmooth(bool point_type);
00080 void checkLineSmooth(bool line_type);
00081 void checkMultisample(bool line_type, bool fill_type);
00082 void drawGeometry(const sglDrawable *drawable);
00083
00084
00085 sglCurrState(const sglCurrState &);
00086 sglCurrState &operator=(const sglCurrState &);
00087
00088 private:
00089 sglFullState m_state;
00090 bool m_point_smooth;
00091 bool m_line_smooth;
00092 bool m_multisample;
00093 };
00094
00095
00096 #endif