OgreCompositorScriptCompiler2.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004 (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org
00006 
00007 Copyright (c) 2000-2006 Torus Knot Software Ltd
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 
00024 You may alternatively use this source under the terms of a specific version of
00025 the OGRE Unrestricted License provided you have obtained such a license from
00026 Torus Knot Software Ltd.
00027 -----------------------------------------------------------------------------
00028 */
00029 
00030 #ifndef __CompositorScriptScompiler2_H__
00031 #define __CompositorScriptScompiler2_H__
00032 
00033 #include "OgreScriptCompiler.h"
00034 #include "OgreCompositionTechnique.h"
00035 #include "OgreCompositionTargetPass.h"
00036 #include "OgreCompositionPass.h"
00037 
00038 namespace Ogre
00039 {
00040     class CompositorScriptCompiler2;
00041     
00045     class _OgreExport CompositorScriptCompilerListener : public ScriptCompilerListener
00046     {
00047     public:
00048         CompositorScriptCompilerListener();
00049 
00051         Compositor *getCompositor(const String &name, const String &group);
00053         virtual bool processNode(ScriptNodeList::iterator &iter, ScriptNodeList::iterator &end, CompositorScriptCompiler2*);
00054     };
00055 
00060     class _OgreExport CompositorScriptCompiler2 : public ScriptCompiler
00061     {
00062     public:
00063         enum
00064         {
00065             ID_COMPOSITOR,
00066             ID_TECHNIQUE,
00067             ID_TARGET,
00068             ID_TARGET_OUTPUT,
00069             ID_PASS,
00070 
00071             ID_TEXTURE,
00072             ID_INPUT,
00073                 ID_NONE,
00074                 ID_PREVIOUS,
00075                 ID_TARGET_WIDTH,
00076                 ID_TARGET_HEIGHT,
00077             ID_ONLY_INITIAL,
00078             ID_VISIBILITY_MASK,
00079             ID_LOD_BIAS,
00080             ID_MATERIAL_SCHEME,
00081 
00082             ID_CLEAR,
00083             ID_STENCIL,
00084             ID_RENDER_SCENE,
00085             ID_RENDER_QUAD,
00086             ID_MATERIAL,
00087             ID_IDENTIFIER,
00088             ID_FIRST_RENDER_QUEUE,
00089             ID_LAST_RENDER_QUEUE,
00090 
00091             ID_BUFFERS,
00092                 ID_COLOUR,
00093                 ID_DEPTH,
00094             ID_COLOUR_VALUE,
00095             ID_DEPTH_VALUE,
00096             ID_STENCIL_VALUE,
00097 
00098             ID_CHECK,
00099             ID_COMP_FUNC,
00100                 ID_ALWAYS_FAIL,
00101                 ID_ALWAYS_PASS,
00102                 ID_LESS_EQUAL,
00103                 ID_LESS,
00104                 ID_EQUAL,
00105                 ID_NOT_EQUAL,
00106                 ID_GREATER_EQUAL,
00107                 ID_GREATER,
00108             ID_REF_VALUE,
00109             ID_MASK,
00110             ID_FAIL_OP,
00111                 ID_KEEP,
00112                 ID_ZERO,
00113                 ID_REPLACE,
00114                 ID_INCREMENT,
00115                 ID_DECREMENT,
00116                 ID_INCREMENT_WRAP,
00117                 ID_DECREMENT_WRAP,
00118                 ID_INVERT,
00119             ID_DEPTH_FAIL_OP,
00120             ID_PASS_OP,
00121             ID_TWO_SIDED
00122         };
00123     public:
00124         CompositorScriptCompiler2();
00125 
00127         void setListener(CompositorScriptCompilerListener *listener);
00128     protected:
00130         bool compileImpl(ScriptNodeListPtr nodes);
00132         bool processNode(ScriptNodeList::iterator &i, ScriptNodeList::iterator &end);
00134         ScriptNodeListPtr loadImportPath(const String &name);
00136         void preParse();
00138         bool errorRaised(const ScriptCompilerErrorPtr &error);
00139     private: // Custom node handling
00140         void compileCompositor(const ScriptNodePtr &node);
00141         void compileTechnique(const ScriptNodePtr &node);
00142         void compileTarget(const ScriptNodePtr &node, CompositionTechnique *technique);
00143         void compileTargetOutput(const ScriptNodePtr &node, CompositionTechnique *technique);
00144         void compilePass(const ScriptNodePtr &node, CompositionTargetPass *target);
00145         void compileTargetOptions(ScriptNodeList::iterator &i, ScriptNodeList::iterator &end, CompositionTargetPass *target);
00146         bool getCompareFunction(const ScriptNodePtr &node, CompareFunction &func);
00147         bool getStencilOp(const ScriptNodePtr &node, StencilOperation &op);
00148         bool getColourValue(ScriptNodeList::iterator &i, ScriptNodeList::iterator &end, ColourValue &c);
00149     private:
00150         // The listener
00151         CompositorScriptCompilerListener *mListener;
00152         // This is the compositor being compiled
00153         Compositor *mCompositor;
00154     };
00155 
00156 }
00157 
00158 #endif

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:22 2009