| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /********************************************************************** 00002 VRS - The Virtual Rendering System 00003 Copyright (C) 2001 Computer Graphics Systems Group at the 00004 Hasso-Plattner-Institute, Potsdam, Germany. 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 This library is distributed in the hope that it will be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 See the GNU Lesser General Public License for more details. 00013 You should have received a copy of the GNU Lesser+ General Public 00014 License along with this library; if not, write to the FreeSoftware 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA, 02111-1307, USA. 00016 **********************************************************************/ 00017 // $Id: backgroundgl.h 6014 2007-08-09 07:51:16Z Konstantin_Baumann $ 00018 // $Date: 2007-08-09 09:51:16 +0200 (Thu, 09 Aug 2007) $ 00019 // $Revision: 6014 $ 00020 // $State$ 00021 // $Author: Konstantin_Baumann $ 00022 // 00023 // $Log$ 00024 // Revision 1.24 2006/03/08 15:17:05 buchholz 00025 // background rendering method is now available from outside to 00026 // allow collaboration with reflection techniques 00027 // 00028 // Revision 1.23 2005/01/03 01:43:09 klimetschek 00029 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00030 // - removed vrs.vcproj 00031 // minor things: 00032 // - added all glutexamples to vrs4glut.sln 00033 // - fixed some problems in glutexamples 00034 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00035 // 00036 // Revision 1.22 2004/03/12 16:28:40 baumann 00037 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00038 // 00039 // Revision 1.21 2004/01/19 11:43:58 baumann 00040 // serialization mechanism improved 00041 // 00042 // Revision 1.20 2004/01/19 07:28:02 baumann 00043 // serialization mechanism improved 00044 // 00045 // Revision 1.19 2003/12/07 16:39:31 baumann 00046 // additional ctor added 00047 // 00048 // Revision 1.18 2003/07/23 17:04:49 baumann 00049 // code cleanup (especially untabified) 00050 // 00051 // Revision 1.17 2003/06/17 11:56:14 buchholz 00052 // missing projection-not-supported-warning included 00053 // 00054 // Revision 1.16 2003/06/11 15:48:28 buchholz 00055 // Added: Automatic 3D texture coordinate computing for cube map textures. 00056 // 00057 // Revision 1.15 2002/12/05 10:25:05 baumann 00058 // BackgroundGL can use a TextureGL-object as background image 00059 // (e.g. for images, pbuffer textures or video streams) 00060 // 00061 // Revision 1.14 2002/10/29 10:32:52 baumann 00062 // macros VRS_CLASSNAME_* and VRS_IMPL_TYPEINFO_* removed 00063 // 00064 // Revision 1.13 2002/04/21 11:09:59 guenther 00065 // made persistent 00066 // 00067 // Revision 1.12 2002/03/03 21:44:25 kosta 00068 // VRS_TYPEINFO-macro rewritten 00069 // 00070 // Revision 1.11 2002/02/19 10:34:17 kosta 00071 // undone all changes since 2002-02-15 00072 // 00073 // Revision 1.8 2002/01/15 16:25:54 kosta 00074 // macros rewritten for a better namespace support 00075 // 00076 // Revision 1.7 2001/11/25 20:24:19 kirsch 00077 // GCC 3.0 fix: added class in friend declaration 00078 // 00079 // Revision 1.6 2001/11/13 16:36:31 kirsch 00080 // changed line feed to unix style (removed control-M) 00081 // 00082 // Revision 1.5 2001/09/05 10:56:11 kirsch 00083 // Documentation updates 00084 // 00085 // Revision 1.4 2001/08/30 13:39:27 kirsch 00086 // CTor of BackgroundGL is now called with two colors and a direction. With 00087 // such a non-unicolor background, the MaintechniqueGL doesn't clear the 00088 // framebuffer anymore 00089 // 00090 // Revision 1.3 2001/08/29 12:09:10 kirsch 00091 // removed background color from canvas, use BackgroundGL instead 00092 // 00093 // Revision 1.2 2001/08/29 08:22:39 kirsch 00094 // constant color constructor 00095 // 00096 // Revision 1.1 2001/08/27 20:36:53 kirsch 00097 // Added BackgroundGL 00098 // 00099 // 00100 00101 #ifndef VRS_OPENGL_BACKGROUNDGL_H 00102 #define VRS_OPENGL_BACKGROUNDGL_H 00103 00104 #include <vrs/color.h> 00105 #include <vrs/opengl/techniquegl.h> 00106 00107 namespace VRS { 00108 00109 class TextureGL; 00110 00111 //- BackgroundTechniqueGL 00112 class VRS_CORE_API BackgroundGL : public TechniqueGL { 00113 public: 00114 00115 enum Direction { TopToBottom, LeftToRight }; 00116 VRS_SERIALIZABLE_CLASS_ENUM(Direction); 00117 00118 BackgroundGL(double intensity=1); 00119 BackgroundGL(double r, double g, double b, double a=1.0); 00120 BackgroundGL(const Color& color); 00121 BackgroundGL(const Color& c0, const Color& c1, Direction direction = BackgroundGL::TopToBottom); 00122 BackgroundGL(TextureGL* backgroundTexture); 00134 void setColor(const Color& color, int index); 00136 Color getColor(int index) const; 00138 00139 void setDirection(BackgroundGL::Direction direction); 00141 BackgroundGL::Direction getDirection() const; 00143 00144 void setTexture(TextureGL* backgroundTexture); 00146 TextureGL* getTexture() const; 00148 00149 virtual bool preparePass(Engine*); 00152 virtual void finishPass(Engine*) { } 00154 00155 virtual bool prepareEval(Engine*, const Shape*) { return false; } 00157 virtual void finishEval(Engine*, const Shape*) { } 00159 00160 00169 bool renderBackground(Engine* engine); 00170 00171 VRS_TYPEINFO(BackgroundGL, TechniqueGL); 00172 VRS_SERIALIZABLE(BackgroundGL); 00173 00174 private: 00175 Direction direction_; 00176 Color c_[2]; 00177 SO<TextureGL> texture_; 00178 }; 00179 00180 } // namespace VRS 00181 00182 #endif // VRS_OPENGL_BACKGROUNDGL_H