inlib
1.2.0
|
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved. 00002 // See the file inlib.license for terms. 00003 00004 #ifndef inlib_sg_state 00005 #define inlib_sg_state 00006 00007 #include <string> 00008 #include <vector> //m_color 00009 00010 #ifdef INLIB_MEM 00011 #include "../mem" 00012 #endif 00013 00014 #include "enums" 00015 00016 namespace inlib { 00017 namespace sg { 00018 00019 class state { 00020 //public: 00021 static const std::string& s_class() { 00022 static const std::string s_v("inlib::sg::state"); 00023 return s_v; 00024 } 00025 public: 00026 state() 00027 //must be consistent with exlib::sg::viewer::render. 00028 :m_GL_DEPTH_TEST(true) 00029 ,m_GL_LIGHTING(false) 00030 ,m_GL_CULL_FACE(true) 00031 ,m_GL_POLYGON_OFFSET_FILL(false) 00032 ,m_winding(winding_ccw) 00033 00034 ,m_light(0) 00035 { 00036 #ifdef INLIB_MEM 00037 mem::increment(s_class().c_str()); 00038 #endif 00039 m_color.push_back(0); 00040 m_color.push_back(0); 00041 m_color.push_back(0); 00042 m_color.push_back(1); 00043 } 00044 virtual ~state(){ 00045 #ifdef INLIB_MEM 00046 mem::decrement(s_class().c_str()); 00047 #endif 00048 } 00049 public: 00050 state(const inlib::sg::state& a_from) 00051 :m_GL_DEPTH_TEST(a_from.m_GL_DEPTH_TEST) 00052 ,m_GL_LIGHTING(a_from.m_GL_LIGHTING) 00053 ,m_GL_CULL_FACE(a_from.m_GL_CULL_FACE) 00054 ,m_GL_POLYGON_OFFSET_FILL(a_from.m_GL_POLYGON_OFFSET_FILL) 00055 ,m_winding(a_from.m_winding) 00056 ,m_color(a_from.m_color) 00057 00058 ,m_light(a_from.m_light) 00059 { 00060 #ifdef INLIB_MEM 00061 mem::increment(s_class().c_str()); 00062 #endif 00063 } 00064 inlib::sg::state& operator=(const inlib::sg::state& a_from){ 00065 m_GL_DEPTH_TEST = a_from.m_GL_DEPTH_TEST; 00066 m_GL_LIGHTING = a_from.m_GL_LIGHTING; 00067 m_GL_CULL_FACE = a_from.m_GL_CULL_FACE; 00068 m_GL_POLYGON_OFFSET_FILL = a_from.m_GL_POLYGON_OFFSET_FILL; 00069 m_winding = a_from.m_winding; 00070 m_color = a_from.m_color; 00071 00072 m_light = a_from.m_light; 00073 return *this; 00074 } 00075 public: 00076 bool m_GL_DEPTH_TEST; 00077 bool m_GL_LIGHTING; 00078 bool m_GL_CULL_FACE; 00079 bool m_GL_POLYGON_OFFSET_FILL; 00080 winding_type m_winding; 00081 std::vector<float> m_color; 00082 00083 unsigned int m_light; 00084 }; 00085 00086 }} 00087 00088 #endif