1 /**
2 Demo of Deferred Shading in OGRE using Multiple Render Targets and HLSL/GLSL high level
3 language shaders.
4 	// W.J. :wumpus: van der Laan 2005 //
5 
6 Deferred shading renders the scene to a 'fat' texture format, using a shader that outputs colour,
7 normal, depth, and possible other attributes per fragment. Multi Render Target is required as we
8 are dealing with many outputs which get written into multiple render textures in the same pass.
9 
10 After rendering the scene in this format, the shading (lighting) can be done as a post process.
11 This means that lighting is done in screen space. Adding them requires nothing more than rendering
12 a screenful quad; thus the method allows for an enormous amount of lights without noticeable
13 performance loss.
14 
15 Little lights affecting small area ("Minilights") can be even further optimised by rendering
16 their convex bounding geometry. This is also shown in this demo by 6 swarming lights.
17 
18 The paper for GDC2004 on Deferred Shading can be found here:
19   http://www.talula.demon.co.uk/DeferredShading.pdf
20 
21 This demo source file is in the public domain.
22 */
23 
24 #include "SamplePlugin.h"
25 #include "DeferredShadingDemo.h"
26 
27 using namespace Ogre;
28 using namespace OgreBites;
29 
30 #ifndef OGRE_STATIC_LIB
31 
32 SamplePlugin* sp;
33 Sample* s;
34 
dllStartPlugin()35 extern "C" _OgreSampleExport void dllStartPlugin()
36 {
37 	s = new Sample_DeferredShading;
38 	sp = OGRE_NEW SamplePlugin(s->getInfo()["Title"] + " Sample");
39 	sp->addSample(s);
40 	Root::getSingleton().installPlugin(sp);
41 }
42 
dllStopPlugin()43 extern "C" _OgreSampleExport void dllStopPlugin()
44 {
45 	Root::getSingleton().uninstallPlugin(sp);
46 	OGRE_DELETE sp;
47 	delete s;
48 }
49 
50 #endif
51