OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreScriptTranslator.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __SCRIPTTRANSLATOR_H_
30 #define __SCRIPTTRANSLATOR_H_
31 
32 #include "OgrePrerequisites.h"
33 #include "OgreScriptCompiler.h"
34 #include "OgreHeaderPrefix.h"
35 
36 namespace Ogre{
49  {
50  public:
56  virtual void translate(ScriptCompiler *compiler, const AbstractNodePtr &node) = 0;
57  protected:
58  // needs virtual destructor
59  virtual ~ScriptTranslator() {}
61  void processNode(ScriptCompiler *compiler, const AbstractNodePtr &node);
62 
64  static AbstractNodeList::const_iterator getNodeAt(const AbstractNodeList &nodes, int index);
66  static bool getBoolean(const AbstractNodePtr &node, bool *result);
68  static bool getString(const AbstractNodePtr &node, String *result);
70  static bool getReal(const AbstractNodePtr &node, Real *result);
72  static bool getFloat(const AbstractNodePtr &node, float *result);
74  static bool getInt(const AbstractNodePtr &node, int *result);
76  static bool getUInt(const AbstractNodePtr &node, uint32 *result);
78  static bool getColour(AbstractNodeList::const_iterator i, AbstractNodeList::const_iterator end, ColourValue *result, int maxEntries = 4);
80  static bool getSceneBlendFactor(const AbstractNodePtr &node, SceneBlendFactor *sbf);
82  static bool getCompareFunction(const AbstractNodePtr &node, CompareFunction *func);
84  static bool getMatrix4(AbstractNodeList::const_iterator i, AbstractNodeList::const_iterator end, Matrix4 *m);
86  static bool getInts(AbstractNodeList::const_iterator i, AbstractNodeList::const_iterator end, int *vals, int count);
88  static bool getFloats(AbstractNodeList::const_iterator i, AbstractNodeList::const_iterator end, float *vals, int count);
90  static bool getStencilOp(const AbstractNodePtr &node, StencilOperation *op);
92  static bool getConstantType(AbstractNodeList::const_iterator i, GpuConstantType *op);
93 
94  };
95 
102  {
103  public:
104  // required - virtual destructor
106 
108  virtual size_t getNumTranslators() const = 0;
110  virtual ScriptTranslator *getTranslator(const AbstractNodePtr&) = 0;
111  };
112 
113  /**************************************************************************
114  * Material compilation section
115  *************************************************************************/
117  {
118  protected:
121  public:
123  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
124  };
125 
127  {
128  protected:
130  public:
132  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
133  };
134 
136  {
137  protected:
139  public:
140  PassTranslator();
141  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
142  protected:
143  void translateVertexProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
144  void translateGeometryProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
145  void translateFragmentProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
146  void translateTesselationHullProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
147  void translateTesselationDomainProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
148  void translateComputeProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
149  void translateShadowCasterVertexProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
150  void translateShadowCasterFragmentProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
151  void translateShadowReceiverVertexProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
152  void translateShadowReceiverFragmentProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
153  };
154 
156  {
157  protected:
159  public:
161  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
162  };
163 
165  {
166  public:
168  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
169  };
170 
172  {
173  public:
175  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
176  protected:
177  void translateGpuProgram(ScriptCompiler *compiler, ObjectAbstractNode *obj);
178  void translateHighLevelGpuProgram(ScriptCompiler *compiler, ObjectAbstractNode *obj);
179  void translateUnifiedGpuProgram(ScriptCompiler *compiler, ObjectAbstractNode *obj);
180  public:
181  static void translateProgramParameters(ScriptCompiler *compiler, GpuProgramParametersSharedPtr params, ObjectAbstractNode *obj);
182  };
183 
185  {
186  public:
188  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
189  protected:
190  };
191 
192  /**************************************************************************
193  * Particle System section
194  *************************************************************************/
196  {
197  protected:
199  public:
201  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
202  };
204  {
205  protected:
207  public:
209  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
210  };
212  {
213  protected:
215  public:
217  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
218  };
219 
220  /**************************************************************************
221  * Compositor section
222  *************************************************************************/
224  {
225  protected:
227  public:
229  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
230  };
232  {
233  protected:
235  public:
237  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
238  };
240  {
241  protected:
243  public:
245  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
246  };
248  {
249  protected:
251  public:
253  void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
254  };
255 
256  /**************************************************************************
257  * BuiltinScriptTranslatorManager
258  *************************************************************************/
261  {
262  private:
277  public:
280  virtual size_t getNumTranslators() const;
282  virtual ScriptTranslator *getTranslator(const AbstractNodePtr &node);
283  };
286 }
287 
288 #include "OgreHeaderSuffix.h"
289 
290 #endif
291 
Class defining particle system based special effects.
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
The ScriptTranslatorManager manages the lifetime and access to script translators.
ParticleEmitterTranslator mParticleEmitterTranslator
float Real
Software floating point type.
CompositionTechniqueTranslator mCompositionTechniqueTranslator
unsigned int uint32
Definition: OgrePlatform.h:344
#define _OgreExport
Definition: OgrePlatform.h:260
Class representing colour.
Ogre::ParticleAffector * mAffector
Class encapsulates rendering properties of an object.
Definition: OgreMaterial.h:88
Class representing a Compositor object.
Class representing an approach to rendering this particular Material.
Definition: OgreTechnique.h:53
Object representing one pass or operation in a composition sequence.
SceneBlendFactor
Blending factors for manually blending objects with the scene.
ParticleAffectorTranslator mParticleAffectorTranslator
Class defining a single pass of a Technique (of a Material), i.e.
Definition: OgrePass.h:80
ParticleSystemTranslator mParticleSystemTranslator
virtual size_t getNumTranslators() const =0
Returns the number of translators being managed.
This class translates script AST (abstract syntax tree) into Ogre resources.
SharedParamsTranslator mSharedParamsTranslator
This specific abstract node represents a script object.
GpuConstantType
Enumeration of the types of constant we may encounter in programs.
CompositionTargetPassTranslator mCompositionTargetPassTranslator
virtual ScriptTranslator * getTranslator(const AbstractNodePtr &)=0
Returns a manager for the given object abstract node, or null if it is not supported.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
list< AbstractNodePtr >::type AbstractNodeList
This class manages the builtin translators.
Abstract class defining the interface to be implemented by particle emitters.
TextureSourceTranslator mTextureSourceTranslator
Base composition technique, can be subclassed in plugins.
Ogre::AliasTextureNamePairList mTextureAliases
Abstract class defining the interface to be implemented by particle affectors.
CompositionPassTranslator mCompositionPassTranslator
Reference-counted shared pointer, used for objects where implicit destruction is required.
_StringBase String
This is the main class for the compiler.
StencilOperation
Enum describing the various actions which can be taken on the stencil buffer.
map< String, String >::type AliasTextureNamePairList
Alias / Texture name pair (first = alias, second = texture name)
Definition: OgreCommon.h:553
CompareFunction
Comparison functions used for the depth/stencil buffer operations and others.
Definition: OgreCommon.h:64
Class representing the state of a single texture unit during a Pass of a Technique, of a Material.
Object representing one render to a RenderTarget or Viewport in the Ogre Composition framework...