| 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: techniqueprocessor.h 4633 2005-01-03 01:43:11Z klimetschek $ 00018 // $Date: 2005-01-03 02:43:11 +0100 (Mon, 03 Jan 2005) $ 00019 // $Revision: 4633 $ 00020 // $State$ 00021 // $Author: klimetschek $ 00022 // 00023 // $Log$ 00024 // Revision 1.30 2005/01/03 01:43:08 klimetschek 00025 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00026 // - removed vrs.vcproj 00027 // minor things: 00028 // - added all glutexamples to vrs4glut.sln 00029 // - fixed some problems in glutexamples 00030 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00031 // 00032 // Revision 1.29 2004/11/05 13:58:09 basch 00033 // Class comment changed (Doxygen style) 00034 // 00035 // Revision 1.28 2004/10/27 14:30:10 kirsch 00036 // use isSimple property of ShapeSimplifiers to invoke shaders and techniques 00037 // only once during the shape evaluation process 00038 // 00039 // Revision 1.27 2004/07/09 09:38:26 kirsch 00040 // Moved check of the filter in engine from techniqueprocessor to scene graph. 00041 // This reduces the number of filter checks for an evaluated shape node in the graph. 00042 // 00043 // Revision 1.26 2004/05/11 06:53:30 baumann 00044 // - methods set/getShapeFilter() added 00045 // - method getTechniqueFilter() added 00046 // 00047 // Revision 1.25 2004/03/15 11:30:41 kirsch 00048 // use SceneGraphBuilder only in rendering processors 00049 // 00050 // Revision 1.23 2003/11/29 11:29:23 kirsch 00051 // - added support for local poly attributes 00052 // - removed PolyAttribute::switchDefault() and Attribute::rememberTransform() 00053 // - renamed Engine::SwType: On/Off/All to Engine::SwitchType: ON/OFF/ALL 00054 // - changed class hierarchy of TechniqueProcessor and Technique 00055 // - GLCanvas::prepareRedisplay() / finishRedisplay() now push / pop standard attributes 00056 // 00057 // Revision 1.22 2003/11/07 14:19:24 kirsch 00058 // removed leading underscore from include guards 00059 // 00060 // Revision 1.21 2003/07/23 17:04:49 baumann 00061 // code cleanup (especially untabified) 00062 // 00063 // Revision 1.20 2003/06/24 15:07:48 kirsch 00064 // code cleanup 00065 // 00066 // Revision 1.19 2003/01/14 13:47:23 kirsch 00067 // removed unneeded includes (technique.h) 00068 // 00069 // Revision 1.18 2003/01/13 15:49:20 kirsch 00070 // removed Processor, Rendering, PretraversalProcessor, SynthesizerGL, AntialiasGL 00071 // 00072 // Revision 1.17 2002/11/30 17:01:12 kirsch 00073 // cleaned up includes 00074 // 00075 // Revision 1.16 2002/10/29 10:32:52 baumann 00076 // macros VRS_CLASSNAME_* and VRS_IMPL_TYPEINFO_* removed 00077 // 00078 // Revision 1.15 2002/06/24 14:03:38 baumann 00079 // changed List<T> to Array<T> 00080 // 00081 // Revision 1.14 2002/03/05 12:07:20 nienhaus 00082 // method to receive active techniques added 00083 // 00084 // Revision 1.13 2002/03/04 11:08:34 kersting 00085 // directory structure changes 00086 // 00087 // Revision 1.12 2002/03/03 21:44:25 kosta 00088 // VRS_TYPEINFO-macro rewritten 00089 // 00090 // Revision 1.11 2002/02/19 10:34:13 kosta 00091 // undone all changes since 2002-02-15 00092 // 00093 // Revision 1.8 2002/01/15 16:25:54 kosta 00094 // macros rewritten for a better namespace support 00095 // 00096 // Revision 1.7 2001/11/13 16:36:31 kirsch 00097 // changed line feed to unix style (removed control-M) 00098 // 00099 // Revision 1.6 2001/09/07 11:04:00 kirsch 00100 // implemented currentPass() 00101 // 00102 // Revision 1.5 2001/09/04 15:17:25 kirsch 00103 // documentation updates, code cleanup 00104 // 00105 // Revision 1.4 2001/08/31 15:45:10 kirsch 00106 // changed List to Array for faster access 00107 // Post/Pretraversal is computed simplier 00108 // 00109 // Revision 1.3 2001/08/15 07:33:58 kirsch 00110 // performance: create active technique iterator tecitr_ only once in a pass 00111 // 00112 // Revision 1.2 2001/07/26 15:23:22 kirsch 00113 // enhanced engine to support rendering techniques 00114 // 00115 // Revision 1.1.2.3 2001/06/20 17:34:01 kirsch 00116 // Switches and TransformTable in Engine totally rewritten, 00117 // posttraversal added. SceneConfiguration nodes are now 00118 // properly installed. 00119 // 00120 // Revision 1.1.2.2 2001/06/15 12:56:05 kirsch 00121 // pretraversal integrated, synthesizer replaced, polyattributes don't get 00122 // properly rendered 00123 // 00124 // Revision 1.1.2.1 2001/06/14 10:23:40 kirsch 00125 // techniques and techniqueprocessor, initial revision 00126 // 00127 00128 #ifndef VRS_TECHNIQUEPROCESSOR_H 00129 #define VRS_TECHNIQUEPROCESSOR_H 00130 00131 #include <vrs/sharedobj.h> 00132 00133 namespace VRS { 00134 00135 class Engine; 00136 class Filter; 00137 class Handler; 00138 class Shape; 00139 class Technique; 00140 template<typename T> class Iterator; 00141 template<typename T> class NonPersistentArray; 00142 00144 class VRS_CORE_API TechniqueProcessor : public SharedObj { 00145 00146 public: 00147 TechniqueProcessor(); 00158 virtual void start(Engine*); 00160 virtual void stop(Engine*); 00162 00163 virtual bool preparePass(Engine*); 00169 virtual void finishPass(Engine*); 00172 virtual void nextPass(Engine*); 00176 virtual bool needsPass(Engine*) const; 00178 virtual int currentPass() const; 00180 00181 virtual void eval(Engine*, const Shape*); 00186 virtual const Handler* getNativeHandler(Engine*, const ID&) const = 0; 00189 virtual bool handleNatively(Engine*, const Shape*, const Handler*) = 0; 00192 virtual bool pretraversal(Engine*) const; 00194 virtual bool maintraversal(Engine*) const; 00196 virtual bool posttraversal(Engine*) const; 00198 00199 virtual bool canBeUsed(Engine* engine) const; 00203 virtual ID category() const; 00207 void setShapeFilter(SO<Filter> filter); 00209 SO<Filter> getShapeFilter() const; 00211 00212 VRS_TYPEINFO(TechniqueProcessor, SharedObj); 00213 00214 protected: 00215 virtual SO<Filter> getTechniqueFilter() const { return NULL; } 00216 00217 bool shapeFilterOK(Engine* E); 00220 void evalWithTechniquesAndShader(Engine*, const Shape*); 00224 void registerTechnique(Technique*); 00226 void unregisterTechnique(Technique*); 00228 00229 virtual void pushStandardTechniques(Engine*); 00232 virtual void popStandardTechniques(Engine*); 00236 void addPass(int pass); 00238 00239 SO<Technique> preTechnique_; 00240 SO<Technique> mainTechnique_; 00241 SO<Technique> postTechnique_; 00242 00243 Iterator<SO<Technique> >* activeTechniques() const; 00244 00245 friend class Technique; 00246 00247 private: 00248 SO<NonPersistentArray<SO<Technique> > > allTechniques_; 00249 SO<NonPersistentArray<SO<Technique> > > activeTechniques_; 00250 SO<NonPersistentArray<int> > remainingPasses_; 00251 SO<Filter> shapeFilter_; 00252 00253 int activePass_; 00254 00255 int findNextPass(); 00256 void retrieveActiveTechniques(); 00257 }; 00258 00259 } // namespace VRS 00260 00261 #endif // VRS_TECHNIQUEPROCESSOR_H