00001 /*===========================================================================*\ 00002 * * 00003 * OpenFlipper * 00004 * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * 00005 * www.openflipper.org * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * This file is part of OpenFlipper. * 00009 * * 00010 * OpenFlipper is free software: you can redistribute it and/or modify * 00011 * it under the terms of the GNU Lesser General Public License as * 00012 * published by the Free Software Foundation, either version 3 of * 00013 * the License, or (at your option) any later version with the * 00014 * following exceptions: * 00015 * * 00016 * If other files instantiate templates or use macros * 00017 * or inline functions from this file, or you compile this file and * 00018 * link it with other files to produce an executable, this file does * 00019 * not by itself cause the resulting executable to be covered by the * 00020 * GNU Lesser General Public License. This exception does not however * 00021 * invalidate any other reasons why the executable file might be * 00022 * covered by the GNU Lesser General Public License. * 00023 * * 00024 * OpenFlipper is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU Lesser General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU LesserGeneral Public * 00030 * License along with OpenFlipper. If not, * 00031 * see <http://www.gnu.org/licenses/>. * 00032 * * 00033 \*===========================================================================*/ 00034 00035 /*===========================================================================*\ 00036 * * 00037 * $Revision: 8638 $ * 00038 * $Author: kremer $ * 00039 * $Date: 2010-03-02 13:53:02 +0100 (Di, 02. Mär 2010) $ * 00040 * * 00041 \*===========================================================================*/ 00042 00043 00044 00045 00046 //============================================================================= 00047 // 00048 // CLASS DrawModes 00049 // 00050 //============================================================================= 00051 00052 #ifndef ACG_DRAWMODES_HH 00053 #define ACG_DRAWMODES_HH 00054 00055 00056 //== FORWARD DECLARATIONS ===================================================== 00057 00058 00059 namespace ACG 00060 { 00061 namespace SceneGraph 00062 { 00063 class BaseNode; 00064 } 00065 } 00066 00067 00068 //== INCLUDES ================================================================= 00069 00070 #include <string> 00071 #include <vector> 00072 #include "../Config/ACGDefines.hh" 00073 #include <bitset> 00074 00075 // Avoid compiler warning in MSC 00076 #if defined (_MSC_VER) 00077 # pragma warning (disable:4251) 00078 #endif 00079 00080 //== NAMESPACES =============================================================== 00081 00082 00083 namespace ACG { 00084 namespace SceneGraph { 00085 00091 namespace DrawModes { 00092 00093 typedef std::bitset<64> ModeFlagSet; 00094 00095 class ACGDLLEXPORT DrawMode { 00096 public: 00097 00098 DrawMode(); 00099 00109 DrawMode(unsigned int _index); 00110 00116 DrawMode( ModeFlagSet _flags ); 00117 00118 bool operator==(const DrawMode& _mode) const; 00119 00120 DrawMode operator&(const DrawMode& _mode); 00121 00122 DrawMode& operator++(); 00123 00124 DrawMode& operator|=( const DrawMode& _mode2 ); 00125 00126 DrawMode& operator&=( const DrawMode& _mode2 ); 00127 00128 bool operator!=( const DrawMode& _mode2 ) const; 00129 00130 DrawMode operator|( const DrawMode& _mode2 ) const; 00131 00132 DrawMode operator^( const DrawMode& _mode2 ) const; 00133 00134 DrawMode operator~( ) const; 00135 00141 unsigned int getIndex(); 00142 00147 std::string description(); 00148 00153 bool isAtomic(); 00154 00157 bool containsAtomicDrawMode( DrawMode _atomicDrawMode ); 00158 00164 std::vector< DrawMode > getAtomicDrawModes(); 00165 00169 unsigned int maxModes(); 00170 00171 operator bool(); 00172 00173 private: 00174 ModeFlagSet modeFlags_; 00175 }; 00176 00177 00179 DrawMode const NONE = ModeFlagSet(0); 00181 DrawMode const DEFAULT = ModeFlagSet(1); 00182 00183 //====================================================================== 00184 // Point Based Rendering Modes 00185 //====================================================================== 00187 DrawMode const POINTS = ModeFlagSet(1) << 1; 00189 DrawMode const POINTS_COLORED = ModeFlagSet(1) << 2; 00191 DrawMode const POINTS_SHADED = ModeFlagSet(1) << 3; 00192 00193 //====================================================================== 00194 // Edge Based Rendering Modes 00195 //====================================================================== 00197 DrawMode const EDGES = ModeFlagSet(1) << 4; 00198 00200 DrawMode const WIREFRAME = ModeFlagSet(1) << 5; 00201 00202 //====================================================================== 00203 // Face Based Rendering Modes 00204 //====================================================================== 00205 DrawMode const FACES = ModeFlagSet(1) << 6; 00206 00207 00208 00210 DrawMode const HIDDENLINE = ModeFlagSet(1) << 7; 00212 DrawMode const SOLID_FLAT_SHADED = ModeFlagSet(1) << 8; 00214 DrawMode const SOLID_SMOOTH_SHADED = ModeFlagSet(1) << 9; 00216 DrawMode const SOLID_PHONG_SHADED = ModeFlagSet(1) << 10; 00218 DrawMode const SOLID_FACES_COLORED = ModeFlagSet(1) << 11; 00220 DrawMode const SOLID_POINTS_COLORED = ModeFlagSet(1) << 12; 00222 DrawMode const SOLID_ENV_MAPPED = ModeFlagSet(1) << 13; 00224 DrawMode const SOLID_TEXTURED = ModeFlagSet(1) << 14; 00226 DrawMode const SOLID_TEXTURED_SHADED = ModeFlagSet(1) << 15; 00228 DrawMode const SOLID_1DTEXTURED = ModeFlagSet(1) << 16; 00230 DrawMode const SOLID_1DTEXTURED_SHADED = ModeFlagSet(1) << 17; 00232 DrawMode const SOLID_3DTEXTURED = ModeFlagSet(1) << 18; 00234 DrawMode const SOLID_3DTEXTURED_SHADED = ModeFlagSet(1) << 19; 00236 DrawMode const SOLID_FACES_COLORED_FLAT_SHADED = ModeFlagSet(1) << 20; 00238 DrawMode const SOLID_2DTEXTURED_FACE = ModeFlagSet(1) << 21; 00240 DrawMode const SOLID_2DTEXTURED_FACE_SHADED = ModeFlagSet(1) << 22; 00243 DrawMode const SOLID_SHADER = ModeFlagSet(1) << 23; 00245 DrawMode const UNUSED = ModeFlagSet(1) << 24; 00246 00247 00248 //======================================================================= 00249 // Non Member Functions 00250 //======================================================================= 00251 00255 ACGDLLEXPORT 00256 void initializeDefaultDrawModes( void ); 00257 00263 ACGDLLEXPORT 00264 bool addDrawMode( const std::string & _name, DrawMode & _newId ); 00265 00270 ACGDLLEXPORT 00271 bool getDrawMode( const std::string & _name, DrawMode & _Id ); 00272 00276 ACGDLLEXPORT 00277 bool drawModeExists(const std::string & _name); 00278 00281 ACGDLLEXPORT 00282 DrawMode getDrawModeFromIndex( unsigned int _index ); 00283 00284 //============================================================================= 00285 } // namespace DrawModes 00286 } // namespace SceneGraph 00287 } // namespace ACG 00288 //============================================================================= 00289 #endif // ACG_DRAWMODES_HH defined 00290 //============================================================================= 00291