This file is indexed.

/usr/include/OGRE/RTShaderSystem/OgreShaderGenerator.h is in libogre-dev 1.7.4-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org

Copyright (c) 2000-2011 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef _ShaderGenerator_
#define _ShaderGenerator_

#include "OgreShaderPrerequisites.h"
#include "OgreSingleton.h"
#include "OgreRenderObjectListener.h"
#include "OgreSceneManager.h"
#include "OgreShaderRenderState.h"
#include "OgreScriptTranslator.h"
#include "OgreShaderScriptTranslator.h"


namespace Ogre {
namespace RTShader {

/** \addtogroup Core
*  @{
*/
/** \addtogroup RTShader
*  @{
*/

/** Shader generator system main interface. This singleton based class
enables automatic generation of shader code based on existing material techniques.
*/
class _OgreRTSSExport ShaderGenerator : public Singleton<ShaderGenerator>, public RTShaderSystemAlloc
{
// Interface.
public:

	/** 
	Initialize the Shader Generator System.
	Return true upon success.
	@param sceneMgr The scene manager that the shader generator will be bound to. 
	*/
	static bool		initialize	();

	/** 
	Finalize the Shader Generator instance.
	*/
	static void		finalize	();


	/** Override standard Singleton retrieval.
	@remarks
	Why do we do this? Well, it's because the Singleton
	implementation is in a .h file, which means it gets compiled
	into anybody who includes it. This is needed for the
	Singleton template to work, but we actually only want it
	compiled into the implementation of the class based on the
	Singleton, not all of them. If we don't change this, we get
	link errors when trying to use the Singleton-based class from
	an outside dll.
	@par
	This method just delegates to the template version anyway,
	but the implementation stays in this single compilation unit,
	preventing link errors.
	*/
	static ShaderGenerator&			getSingleton	();	


	/** Override standard Singleton retrieval.
	@remarks
	Why do we do this? Well, it's because the Singleton
	implementation is in a .h file, which means it gets compiled
	into anybody who includes it. This is needed for the
	Singleton template to work, but we actually only want it
	compiled into the implementation of the class based on the
	Singleton, not all of them. If we don't change this, we get
	link errors when trying to use the Singleton-based class from
	an outside dll.
	@par
	This method just delegates to the template version anyway,
	but the implementation stays in this single compilation unit,
	preventing link errors.
	*/
	static ShaderGenerator*			getSingletonPtr	();

	/** 
	Add a scene manager to the shader generator scene managers list.
	@param sceneMgr The scene manager to add to the list.
	*/
	void			addSceneManager				(SceneManager* sceneMgr);

	/** 
	Remove a scene manager from the shader generator scene managers list.
	@param sceneMgr The scene manager to remove from the list.
	*/
	void			removeSceneManager			(SceneManager* sceneMgr);

	/** 
	Get the active scene manager that is doint the actual scene rendering.
	This attribute will be update on the call to preFindVisibleObjects. 
	*/
	SceneManager*	getActiveSceneManager		();
	
	/** 
	Set the target shader language.
	@param shaderLanguage The output shader language to use.	
	@remarks The default shader language is cg.
	*/
	void			setTargetLanguage			(const String& shaderLanguage);

	/** 
	Return the target shader language currently in use.		
	*/
	const String&	getTargetLanguage			() const { return mShaderLanguage; }

	/** 
	Set the output vertex shader target profiles.
	@param vertexShaderProfile The target profiles for the vertex shader.	
	*/
	void			setVertexShaderProfiles		(const String& vertexShaderProfiles);

	/** 
	Get the output vertex shader target profiles.	
	*/
	const String&	getVertexShaderProfiles		() const { return mVertexShaderProfiles; }

	/** 
	Get the output vertex shader target profiles as list of strings.	
	*/
	const StringVector&	getVertexShaderProfilesList		() const { return mVertexShaderProfilesList; }


	/** 
	Set the output fragment shader target profiles.
	@param fragmentShaderProfile The target profiles for the fragment shader.	
	*/
	void			setFragmentShaderProfiles	(const String& fragmentShaderProfiles);

	/** 
	Get the output fragment shader target profiles.	
	*/
	const String&	getFragmentShaderProfiles	() const { return mFragmentShaderProfiles; }

	/** 
	Get the output fragment shader target profiles as list of strings.
	*/
	const StringVector&	getFragmentShaderProfilesList	() const { return mFragmentShaderProfilesList; }

	/** 
	Set the output shader cache path. Generated shader code will be written to this path.
	In case of empty cache path shaders will be generated directly from system memory.
	@param cachePath The cache path of the shader.	
	The default is empty cache path.
	*/
	void			setShaderCachePath			(const String& cachePath);

	/** 
	Get the output shader cache path.
	*/
	const String&	getShaderCachePath			() const { return mShaderCachePath; }

	/** 
	Flush the shader cache. This operation will cause all active sachems to be invalidated and will
	destroy any CPU/GPU program that created by this shader generator.
	*/
	void			flushShaderCache			();

	/** 
	Return a global render state associated with the given scheme name.
	Modifying this render state will affect all techniques that belongs to that scheme.
	This is the best way to apply global changes to all techniques.
	After altering the render state one should call invalidateScheme method in order to 
	regenerate shaders.
	@param schemeName The destination scheme name.
	*/
	RenderState*	getRenderState				(const String& schemeName);

	/** 
	Get render state of specific pass.
	Using this method allows the user to customize the behavior of a specific pass.
	@param schemeName The destination scheme name.
	@param materialName The specific material name.
	@param passIndex The pass index.
	*/
	RenderState*	getRenderState				(const String& schemeName, const String& materialName, unsigned short passIndex);

	/** 
	Add sub render state factory. Plugins or 3d party applications may implement sub classes of
	SubRenderState interface. Add the matching factory will allow the application to create instances 
	of these sub classes.
	@param factory The factory to add.
	*/
	void			addSubRenderStateFactory	(SubRenderStateFactory* factory);

	/** 
	Remove sub render state factory. 
	@param factory The factory to remove.
	*/
	void			removeSubRenderStateFactory	(SubRenderStateFactory* factory);

	/** 
	Create an instance of sub render state from a given type. 
	@param type The type of sub render state to create.
	*/
	SubRenderState*	createSubRenderState		(const String& type);

	
	/** 
	Destroy an instance of sub render state. 
	@param subRenderState The instance to destroy.
	*/
	void			destroySubRenderState		(SubRenderState* subRenderState);


	/** 
	Create shader based technique from a given technique. 
	Return true upon success. Failure may occur if the source technique is not FFP pure, or different
	source technique is mapped to the requested destination scheme.
	@param materialName The source material name.
	@param srcTechniqueSchemeName The source technique scheme name.
	@param dstTechniqueSchemeName The destination shader based technique scheme name.
	*/
	bool			createShaderBasedTechnique	(const String& materialName, const String& srcTechniqueSchemeName, const String& dstTechniqueSchemeName);


	/** 
	Remove shader based technique from a given technique. 
	Return true upon success. Failure may occur if the given source technique was not previously
	registered successfully using the createShaderBasedTechnique method.
	@param materialName The source material name.
	@param srcTechniqueSchemeName The source technique scheme name.
	@param dstTechniqueSchemeName The destination shader based technique scheme name.
	*/
	bool			removeShaderBasedTechnique	(const String& materialName, const String& srcTechniqueSchemeName, const String& dstTechniqueSchemeName);


	/** 
	Remove all shader based techniques of the given material. 
	Return true upon success.
	@param materialName The source material name.	
	*/
	bool			removeAllShaderBasedTechniques	(const String& materialName);

	/** 
	Remove all shader based techniques that created by this shader generator.	
	*/
	void			removeAllShaderBasedTechniques	();

	/** 
	Create a scheme.
	@param schemeName The scheme name to create.
	*/
	void			createScheme				(const String& schemeName);

	/** 
	Invalidate a given scheme. This action will lead to shader regeneration of all techniques belongs to the
	given scheme name.
	@param schemeName The scheme to invalidate.
	*/
	void			invalidateScheme			(const String& schemeName);

	/** 
	Validate a given scheme. This action will generate shader programs for all techniques of the
	given scheme name.
	@param schemeName The scheme to validate.
	*/
	bool			validateScheme				(const String& schemeName);
	
	/** 
	Invalidate specific material scheme. This action will lead to shader regeneration of the technique belongs to the
	given scheme name.
	@param schemeName The scheme to invalidate.
	@param materialName The material to invalidate.
	*/
	void			invalidateMaterial			(const String& schemeName, const String& materialName);

	/** 
	Validate specific material scheme. This action will generate shader programs for the technique of the
	given scheme name.
	@param schemeName The scheme to validate.
	@param materialName The material to validate.
	*/
	bool			validateMaterial			(const String& schemeName, const String& materialName);	


	/** 
	Return custom material Serializer of the shader generator.
	This is useful when you'd like to export certain material that contains shader generator effects.
	I.E - when writing an exporter you may want mark your material as shader generated material 
	so in the next time you will load it by your application it will automatically generate shaders with custom
	attributes you wanted. To do it you'll have to do the following steps:
	1. Create shader based technique for you material via the createShaderBasedTechnique() method.
	2. Create MaterialSerializer instance.
	3. Add the return instance of serializer listener to the MaterialSerializer.
	4. Call one of the export methods of MaterialSerializer.
	*/
	SGMaterialSerializerListener*	getMaterialSerializerListener();


	/** Return the current number of generated vertex shaders. */
	size_t							getVertexShaderCount			() const;


	/** Return the current number of generated fragment shaders. */
	size_t							getFragmentShaderCount			() const;



	/** Set the vertex shader outputs compaction policy. 
	@see VSOutputCompactPolicy.
	@param policy The policy to set.
	*/
	void							setVertexShaderOutputsCompactPolicy		(VSOutputCompactPolicy policy)  { mVSOutputCompactPolicy = policy; }
	
	/** Get the vertex shader outputs compaction policy. 
	@see VSOutputCompactPolicy.	
	*/
	VSOutputCompactPolicy			getVertexShaderOutputsCompactPolicy		() const { return mVSOutputCompactPolicy; }

	/// Default material scheme of the shader generator.
	static String DEFAULT_SCHEME_NAME;

// Protected types.
protected:
	class SGPass;
	class SGTechnique;
	class SGMaterial;
	class SGScheme;

	typedef vector<SGPass*>::type					SGPassList;
	typedef SGPassList::iterator					SGPassIterator;
	typedef SGPassList::const_iterator				SGPassConstIterator;

	typedef vector<SGTechnique*>::type				SGTechniqueList;
	typedef SGTechniqueList::iterator				SGTechniqueIterator;
	typedef SGTechniqueList::const_iterator			SGTechniqueConstIterator;

	typedef map<SGTechnique*, SGTechnique*>::type	SGTechniqueMap;
	typedef SGTechniqueMap::iterator				SGTechniqueMapIterator;
	
	typedef map<String, SGMaterial*>::type			SGMaterialMap;
	typedef SGMaterialMap::iterator					SGMaterialIterator;
	typedef SGMaterialMap::const_iterator			SGMaterialConstIterator;

	typedef map<String, SGScheme*>::type			SGSchemeMap;
	typedef SGSchemeMap::iterator					SGSchemeIterator;
	typedef SGMaterialMap::const_iterator			SGSchemeConstIterator;

	typedef map<String, ScriptTranslator*>::type	SGScriptTranslatorMap;
	typedef SGScriptTranslatorMap::iterator			SGScriptTranslatorIterator;
	typedef SGScriptTranslatorMap::const_iterator	SGScriptTranslatorConstIterator;


	
	/** Shader generator pass wrapper class. */
	class _OgreRTSSExport SGPass : public RTShaderSystemAlloc
	{
	public:
		SGPass			(SGTechnique* parent, Pass* srcPass, Pass* dstPass);
		~SGPass			();
	
		/** Build the render state. */
		void			buildTargetRenderState			();

		/** Acquire the CPU/GPU programs for this pass. */
		void			acquirePrograms			();

		/** Release the CPU/GPU programs of this pass. */
		void			releasePrograms			();


		/** Called when a single object is about to be rendered. */
		void			notifyRenderSingleObject	(Renderable* rend, const AutoParamDataSource* source, const LightList* pLightList, bool suppressRenderStateChanges);

		/** Get source pass. */
		Pass*			getSrcPass					() { return mSrcPass; }

		/** Get destination pass. */
		Pass*			getDstPass					() { return mDstPass; }

		/** Get custom FPP sub state of this pass. */
		SubRenderState*	getCustomFFPSubState		(int subStateOrder);

		/** Get custom render state of this pass. */
		RenderState*	getCustomRenderState		() { return mCustomRenderState; }

		/** Set the custom render state of this pass. */
		void			setCustomRenderState		(RenderState* customRenderState) { mCustomRenderState = customRenderState; }

		static String	UserKey;					// Key name for associating with a Pass instance.
	
	protected:
		SubRenderState*	getCustomFFPSubState		(int subStateOrder, const RenderState* renderState);

	protected:
		SGTechnique*			mParent;				// Parent technique.
		Pass*					mSrcPass;				// Source pass.
		Pass*					mDstPass;				// Destination pass.
		RenderState*			mCustomRenderState;		// Custom render state.
		TargetRenderState*		mTargetRenderState;	// The compiled render state.		
	};

	
	/** Shader generator technique wrapper class. */
	class _OgreRTSSExport SGTechnique : public RTShaderSystemAlloc
	{
	public:
		SGTechnique			(SGMaterial* parent, Technique* srcTechnique, const String& dstTechniqueSchemeName);		
		~SGTechnique		();
		
		/** Get the parent SGMaterial */
		const SGMaterial*	getParent						() const { return mParent; }
		
		/** Get the source technique. */
		Technique*			getSourceTechnique				() { return mSrcTechnique; }

		/** Get the destination technique. */
		Technique*			getDestinationTechnique			() { return mDstTechnique; }

		/** Get the destination technique scheme name. */
		const String&		getDestinationTechniqueSchemeName() const { return mDstTechniqueSchemeName; }
		
		/** Build the render state. */
		void				buildTargetRenderState				();

		/** Acquire the CPU/GPU programs for this technique. */
		void				acquirePrograms				();

		/** Release the CPU/GPU programs of this technique. */
		void				releasePrograms				();

		/** Tells the technique that it needs to generate shader code. */
		void				setBuildDestinationTechnique	(bool buildTechnique)	{ mBuildDstTechnique = buildTechnique; }		

		/** Tells if the destination technique should be build. */
		bool				getBuildDestinationTechnique	() const				{ return mBuildDstTechnique; }

		/** Get render state of specific pass.
		@param passIndex The pass index.
		*/
		RenderState*		getRenderState					(unsigned short passIndex);

		static String	UserKey;					// Key name for associating with a Technique instance.

	protected:
		
		/** Create the passes entries. */
		void				createSGPasses			();

		/** Destroy the passes entries. */
		void				destroySGPasses			();

		
	protected:
		SGMaterial*				mParent;					// Parent material.		
		Technique*				mSrcTechnique;				// Source technique.
		Technique*				mDstTechnique;				// Destination technique.
		SGPassList				mPassEntries;				// All passes entries.
		RenderStateList			mCustomRenderStates;		// The custom render states of all passes.
		bool					mBuildDstTechnique;			// Flag that tells if destination technique should be build.		
		String					mDstTechniqueSchemeName;	// Scheme name of destination technique.
	};

	
	/** Shader generator material wrapper class. */
	class _OgreRTSSExport SGMaterial : public RTShaderSystemAlloc
	{	
	
	public:
		/** Class constructor. */
		SGMaterial(const String& materialName)					{ mName = materialName; }

		/** Get the material name. */
		const String& getMaterialName				() const	{ return mName; }
		
		/** Get the const techniques list of this material. */
		const SGTechniqueList&	getTechniqueList	() const	 { return mTechniqueEntires; }

		/** Get the techniques list of this material. */
		SGTechniqueList&	getTechniqueList		() 			 { return mTechniqueEntires; }
	
	protected:
		String				mName;					// The material name.
		SGTechniqueList		mTechniqueEntires;		// All passes entries.
	};

	
	/** Shader generator scheme class. */
	class _OgreRTSSExport SGScheme : public RTShaderSystemAlloc
	{	
	public:
		SGScheme		(const String& schemeName);
		~SGScheme		();	


		/** Return true if this scheme dose not contains any techniques.
		*/
		bool					empty				() const  { return mTechniqueEntires.empty(); }
		
		/** Invalidate the whole scheme.
		@see ShaderGenerator::invalidateScheme.
		*/
		void					invalidate				();

		/** Validate the whole scheme.
		@see ShaderGenerator::validateScheme.
		*/
		void					validate				();

		/** Invalidate specific material.
		@see ShaderGenerator::invalidateMaterial.
		*/
		void					invalidate				(const String& materialName);

		/** Validate specific material.
		@see ShaderGenerator::validateMaterial.
		*/
		bool					validate				(const String& materialName);
				
		/** Add a technique to current techniques list. */
		void					addTechniqueEntry		(SGTechnique* techEntry);

		/** Remove a technique from the current techniques list. */
		void					removeTechniqueEntry	(SGTechnique* techEntry);


		/** Get global render state of this scheme. 
		@see ShaderGenerator::getRenderState.
		*/
		RenderState*			getRenderState			();

		/** Get specific pass render state. 
		@see ShaderGenerator::getRenderState.
		*/
		RenderState*			getRenderState			(const String& materialName, unsigned short passIndex);

	protected:
		/** Synchronize the current light settings of this scheme with the current settings of the scene. */
		void					synchronizeWithLightSettings	();

		/** Synchronize the fog settings of this scheme with the current settings of the scene. */
		void					synchronizeWithFogSettings		();


	protected:
		String					mName;					// Scheme name.
		SGTechniqueList			mTechniqueEntires;		// Technique entries.
		bool					mOutOfDate;				// Tells if this scheme is out of date.
		RenderState*			mRenderState;			// The global render state of this scheme.
		FogMode					mFogMode;				// Current fog mode.
	};


// Protected types.
protected:
	
	/** Shader generator RenderObjectListener sub class. */
	class _OgreRTSSExport SGRenderObjectListener : public RenderObjectListener, public RTShaderSystemAlloc
	{
	public:
		SGRenderObjectListener(ShaderGenerator* owner)
		{
			mOwner = owner;
		}

		/** 
		Listener overridden function notify the shader generator when rendering single object.
		*/
		virtual void notifyRenderSingleObject(Renderable* rend, const Pass* pass,  
			const AutoParamDataSource* source, 
			const LightList* pLightList, bool suppressRenderStateChanges)
		{
			mOwner->notifyRenderSingleObject(rend, pass, source, pLightList, suppressRenderStateChanges);
		}

	protected:
		ShaderGenerator* mOwner;
	};

	/** Shader generator scene manager sub class. */
	class _OgreRTSSExport SGSceneManagerListener : public SceneManager::Listener, public RTShaderSystemAlloc
	{
	public:
		SGSceneManagerListener(ShaderGenerator* owner)
		{
			mOwner = owner;
		}

		/** 
		Listener overridden function notify the shader generator when finding visible objects process started.
		*/
		virtual void preFindVisibleObjects(SceneManager* source, 
			SceneManager::IlluminationRenderStage irs, Viewport* v)
		{
			mOwner->preFindVisibleObjects(source, irs, v);
		}

		virtual void postFindVisibleObjects(SceneManager* source, 
			SceneManager::IlluminationRenderStage irs, Viewport* v)
		{

		}

		virtual void shadowTexturesUpdated(size_t numberOfShadowTextures) 
		{

		}

		virtual void shadowTextureCasterPreViewProj(Light* light, 
			Camera* camera, size_t iteration) 
		{

		}

		virtual void shadowTextureReceiverPreViewProj(Light* light, 
			Frustum* frustum)
		{

		}

	protected:
		ShaderGenerator* mOwner;			// The shader generator instance.
	};

	/** Shader generator ScriptTranslatorManager sub class. */
	class _OgreRTSSExport SGScriptTranslatorManager : public ScriptTranslatorManager
	{
	public:
		SGScriptTranslatorManager(ShaderGenerator* owner)
		{
			mOwner = owner;
		}

		/// Returns the number of translators being managed
		virtual size_t getNumTranslators() const
		{
			return mOwner->getNumTranslators();
		}
		
		/// Returns a manager for the given object abstract node, or null if it is not supported
		virtual ScriptTranslator *getTranslator(const AbstractNodePtr& node)
		{
			return mOwner->getTranslator(node);
		}

	protected:
		ShaderGenerator* mOwner;		// The shader generator instance.
	};

	//-----------------------------------------------------------------------------
	typedef map<String, SubRenderStateFactory*>::type 		SubRenderStateFactoryMap;
	typedef SubRenderStateFactoryMap::iterator 				SubRenderStateFactoryIterator;
	typedef SubRenderStateFactoryMap::const_iterator		SubRenderStateFactoryConstIterator;

	//-----------------------------------------------------------------------------
	typedef map<String, SceneManager*>::type 				SceneManagerMap;
	typedef SceneManagerMap::iterator 						SceneManagerIterator;
	typedef SceneManagerMap::const_iterator					SceneManagerConstIterator;

protected:
	/** Class default constructor */
	ShaderGenerator		();

	/** Class destructor */
	~ShaderGenerator	();

	/** Initialize the shader generator instance. */
	bool				_initialize			();
	
	/** Finalize the shader generator instance. */
	void				_finalize			();

	/** Find source technique to generate shader based technique based on it. */
	Technique*			findSourceTechnique				(const String& materialName, const String& srcTechniqueSchemeName);

	/** Called from the sub class of the RenderObjectLister when single object is rendered. */
	void				notifyRenderSingleObject		(Renderable* rend, const Pass* pass,  const AutoParamDataSource* source, const LightList* pLightList, bool suppressRenderStateChanges);

	/** Called from the sub class of the SceneManager::Listener when finding visible object process starts. */
	void				preFindVisibleObjects			(SceneManager* source, SceneManager::IlluminationRenderStage irs, Viewport* v);

	/** Create sub render state core extensions factories */
	void				createSubRenderStateExFactories			();

	/** Destroy sub render state core extensions factories */
	void				destroySubRenderStateExFactories		();

	/** Create an instance of the SubRenderState based on script properties using the
	current sub render state factories.
	@see SubRenderStateFactory::createInstance	
	@param compiler The compiler instance.
	@param prop The abstract property node.
	@param pass The pass that is the parent context of this node.
	*/
	SubRenderState*		createSubRenderState				(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass);

	/** 
	Add custom script translator. 
	Return true upon success.
	@param key The key name of the given translator.
	@param translator The translator to associate with the given key.
	*/
	bool				addCustomScriptTranslator			(const String& key, ScriptTranslator* translator);

	/** 
	Remove custom script translator. 
	Return true upon success.
	@param key The key name of the translator to remove.	
	*/
	bool				removeCustomScriptTranslator		(const String& key);

	/** Return number of script translators. */
	size_t				getNumTranslators					() const;

	/** Return a matching script translator. */
	ScriptTranslator*	getTranslator						(const AbstractNodePtr& node);


	/** This method called by instance of SGMaterialSerializerListener and 
	serialize a given pass entry attributes.
	@param ser The material serializer.
	@param passEntry The SGPass instance.
	*/
	void				serializePassAttributes				(MaterialSerializer* ser, SGPass* passEntry);



protected:	
	OGRE_AUTO_MUTEX													// Auto mutex.
	SceneManager*					mActiveSceneMgr;				// The active scene manager.
	SceneManagerMap					mSceneManagerMap;				// A map of all scene managers this generator is bound to.
	SGRenderObjectListener*			mRenderObjectListener;			// Render object listener.
	SGSceneManagerListener*			mSceneManagerListener;			// Scene manager listener.
	SGScriptTranslatorManager*		mScriptTranslatorManager;		// Script translator manager.
	SGMaterialSerializerListener*	mMaterialSerializerListener;	// Custom material Serializer listener - allows exporting material that contains shader generated techniques.
	SGScriptTranslatorMap			mScriptTranslatorsMap;			// A map of the registered custom script translators.
	SGScriptTranslator				mCoreScriptTranslator;			// The core translator of the RT Shader System.
	String							mShaderLanguage;				// The target shader language (currently only cg supported).
	String							mVertexShaderProfiles;			// The target vertex shader profile. Will be used as argument for program compilation.
	StringVector					mVertexShaderProfilesList;		// List of target vertex shader profiles.
	String							mFragmentShaderProfiles;		// The target fragment shader profile. Will be used as argument for program compilation.
	StringVector					mFragmentShaderProfilesList;	// List of target fragment shader profiles..
	String							mShaderCachePath;				// Path for caching the generated shaders.
	ProgramManager*					mProgramManager;				// Shader program manager.
	ProgramWriterManager*			mProgramWriterManager;			// Shader program writer manager.
	FFPRenderStateBuilder*			mFFPRenderStateBuilder;			// Fixed Function Render state builder.
	SGMaterialMap					mMaterialEntriesMap;			// Material entries map.
	SGSchemeMap						mSchemeEntriesMap;				// Scheme entries map.
	SGTechniqueMap					mTechniqueEntriesMap;			// All technique entries map.
	SubRenderStateFactoryMap		mSubRenderStateFactories;		// Sub render state registered factories.
	SubRenderStateFactoryMap		mSubRenderStateExFactories;		// Sub render state core extension factories.
	bool							mActiveViewportValid;			// True if active view port use a valid SGScheme.
	int								mLightCount[3];					// Light count per light type.
	VSOutputCompactPolicy			mVSOutputCompactPolicy;			// Vertex shader outputs compact policy.
	
private:
	friend class SGPass;
	friend class FFPRenderStateBuilder;
	friend class SGScriptTranslatorManager;
	friend class SGScriptTranslator;
	friend class SGMaterialSerializerListener;
	
};

/** @} */
/** @} */

}
}

#endif