aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/doc/html/example016.html
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/doc/html/example016.html')
-rw-r--r--src/others/irrlicht-1.8.1/doc/html/example016.html401
1 files changed, 401 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/doc/html/example016.html b/src/others/irrlicht-1.8.1/doc/html/example016.html
new file mode 100644
index 0000000..52b9893
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/doc/html/example016.html
@@ -0,0 +1,401 @@
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5<title>Irrlicht 3D Engine: Tutorial 16: Quake3 Map Shader Support</title>
6
7<link href="tabs.css" rel="stylesheet" type="text/css"/>
8<link href="doxygen.css" rel="stylesheet" type="text/css" />
9<link href="navtree.css" rel="stylesheet" type="text/css"/>
10<script type="text/javascript" src="jquery.js"></script>
11<script type="text/javascript" src="resize.js"></script>
12<script type="text/javascript" src="navtree.js"></script>
13<script type="text/javascript">
14 $(document).ready(initResizable);
15</script>
16<link href="search/search.css" rel="stylesheet" type="text/css"/>
17<script type="text/javascript" src="search/search.js"></script>
18<script type="text/javascript">
19 $(document).ready(function() { searchBox.OnSelectItem(0); });
20</script>
21
22</head>
23<body>
24<div id="top"><!-- do not remove this div! -->
25
26
27<div id="titlearea">
28<table cellspacing="0" cellpadding="0">
29 <tbody>
30 <tr style="height: 56px;">
31
32 <td id="projectlogo"><img alt="Logo" src="irrlichtlogo.png"/></td>
33
34
35 <td style="padding-left: 0.5em;">
36 <div id="projectname">Irrlicht 3D Engine
37
38 </div>
39
40 </td>
41
42
43
44
45 <td> <div id="MSearchBox" class="MSearchBoxInactive">
46 <span class="left">
47 <img id="MSearchSelect" src="search/mag_sel.png"
48 onmouseover="return searchBox.OnSearchSelectShow()"
49 onmouseout="return searchBox.OnSearchSelectHide()"
50 alt=""/>
51 <input type="text" id="MSearchField" value="Search" accesskey="S"
52 onfocus="searchBox.OnSearchFieldFocus(true)"
53 onblur="searchBox.OnSearchFieldFocus(false)"
54 onkeyup="searchBox.OnSearchFieldChange(event)"/>
55 </span><span class="right">
56 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
57 </span>
58 </div>
59</td>
60
61
62 </tr>
63 </tbody>
64</table>
65</div>
66
67<!-- Generated by Doxygen 1.7.5.1 -->
68<script type="text/javascript">
69var searchBox = new SearchBox("searchBox", "search",false,'Search');
70</script>
71<script type="text/javascript" src="dynsections.js"></script>
72</div>
73<div id="side-nav" class="ui-resizable side-nav-resizable">
74 <div id="nav-tree">
75 <div id="nav-tree-contents">
76 </div>
77 </div>
78 <div id="splitbar" style="-moz-user-select:none;"
79 class="ui-resizable-handle">
80 </div>
81</div>
82<script type="text/javascript">
83 initNavTree('example016.html','');
84</script>
85<div id="doc-content">
86<div class="header">
87 <div class="headertitle">
88<div class="title">Tutorial 16: Quake3 Map Shader Support </div> </div>
89</div>
90<div class="contents">
91<div class="textblock"><div class="image">
92<img src="016shot.jpg" alt="016shot.jpg"/>
93</div>
94 <p>This Tutorial shows how to load a Quake 3 map into the engine, create a SceneNode for optimizing the speed of rendering and how to create a user controlled camera.</p>
95<p>Lets start like the HelloWorld example: We include the irrlicht header files and an additional file to be able to ask the user for a driver type using the console. </p>
96<div class="fragment"><pre class="fragment"><span class="preprocessor">#include &lt;<a class="code" href="irrlicht_8h.html" title="Main header file of the irrlicht, the only file needed to include.">irrlicht.h</a>&gt;</span>
97<span class="preprocessor">#include &quot;<a class="code" href="driver_choice_8h.html">driverChoice.h</a>&quot;</span>
98</pre></div><p>define which Quake3 Level should be loaded </p>
99<div class="fragment"><pre class="fragment"><span class="preprocessor">#define IRRLICHT_QUAKE3_ARENA</span>
100<span class="preprocessor"></span><span class="comment">//#define ORIGINAL_QUAKE3_ARENA</span>
101<span class="comment">//#define CUSTOM_QUAKE3_ARENA</span>
102<span class="comment">//#define SHOW_SHADER_NAME</span>
103
104<span class="preprocessor">#ifdef ORIGINAL_QUAKE3_ARENA</span>
105<span class="preprocessor"></span><span class="preprocessor"> #define QUAKE3_STORAGE_FORMAT addFolderFileArchive</span>
106<span class="preprocessor"></span><span class="preprocessor"> #define QUAKE3_STORAGE_1 &quot;/baseq3/&quot;</span>
107<span class="preprocessor"></span><span class="preprocessor"> #ifdef CUSTOM_QUAKE3_ARENA</span>
108<span class="preprocessor"></span><span class="preprocessor"> #define QUAKE3_STORAGE_2 &quot;/cf/&quot;</span>
109<span class="preprocessor"></span><span class="preprocessor"> #define QUAKE3_MAP_NAME &quot;maps/cf.bsp&quot;</span>
110<span class="preprocessor"></span><span class="preprocessor"> #else</span>
111<span class="preprocessor"></span><span class="preprocessor"> #define QUAKE3_MAP_NAME &quot;maps/q3dm8.bsp&quot;</span>
112<span class="preprocessor"></span><span class="preprocessor"> #endif</span>
113<span class="preprocessor"></span><span class="preprocessor">#endif</span>
114<span class="preprocessor"></span>
115<span class="preprocessor">#ifdef IRRLICHT_QUAKE3_ARENA</span>
116<span class="preprocessor"></span><span class="preprocessor"> #define QUAKE3_STORAGE_FORMAT addFileArchive</span>
117<span class="preprocessor"></span><span class="preprocessor"> #define QUAKE3_STORAGE_1 &quot;../../media/map-20kdm2.pk3&quot;</span>
118<span class="preprocessor"></span><span class="preprocessor"> #define QUAKE3_MAP_NAME &quot;maps/20kdm2.bsp&quot;</span>
119<span class="preprocessor"></span><span class="preprocessor">#endif</span>
120<span class="preprocessor"></span>
121<span class="keyword">using namespace </span>irr;
122<span class="keyword">using namespace </span>scene;
123</pre></div><p>Again, to be able to use the Irrlicht.DLL file, we need to link with the Irrlicht.lib. We could set this option in the project settings, but to make it easy, we use a pragma comment lib: </p>
124<div class="fragment"><pre class="fragment"><span class="preprocessor">#ifdef _MSC_VER</span>
125<span class="preprocessor"></span><span class="preprocessor">#pragma comment(lib, &quot;Irrlicht.lib&quot;)</span>
126<span class="preprocessor">#endif</span>
127</pre></div><p>A class to produce a series of screenshots </p>
128<div class="fragment"><pre class="fragment"><span class="keyword">class </span>CScreenShotFactory : <span class="keyword">public</span> IEventReceiver
129{
130<span class="keyword">public</span>:
131
132 CScreenShotFactory( IrrlichtDevice *device, <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> * templateName, ISceneNode* node )
133 : Device(device), Number(0), FilenameTemplate(templateName), Node(node)
134 {
135 FilenameTemplate.replace ( <span class="charliteral">&#39;/&#39;</span>, <span class="charliteral">&#39;_&#39;</span> );
136 FilenameTemplate.replace ( <span class="charliteral">&#39;\\&#39;</span>, <span class="charliteral">&#39;_&#39;</span> );
137 }
138
139 <span class="keywordtype">bool</span> OnEvent(<span class="keyword">const</span> SEvent&amp; event)
140 {
141 <span class="comment">// check if user presses the key F9</span>
142 <span class="keywordflow">if</span> ((event.EventType == <a class="code" href="namespaceirr.html#ac9eed96e06e85ce3c86fcbbbe9e48a0ca6f90390f3147a1693e5e2e3422d6ca09" title="A key input event.">EET_KEY_INPUT_EVENT</a>) &amp;&amp;
143 event.KeyInput.PressedDown)
144 {
145 <span class="keywordflow">if</span> (event.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a5dfbe4e0c7c8d9d810717fc1331fd3c9">KEY_F9</a>)
146 {
147 video::IImage* image = Device-&gt;getVideoDriver()-&gt;createScreenShot();
148 <span class="keywordflow">if</span> (image)
149 {
150 <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> buf[256];
151 snprintf(buf, 256, <span class="stringliteral">&quot;%s_shot%04d.jpg&quot;</span>,
152 FilenameTemplate.c_str(),
153 ++Number);
154 Device-&gt;getVideoDriver()-&gt;writeImageToFile(image, buf, 85 );
155 image-&gt;drop();
156 }
157 }
158 <span class="keywordflow">else</span>
159 <span class="keywordflow">if</span> (event.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a5111be01fea6429912b3e497b2a85d73">KEY_F8</a>)
160 {
161 <span class="keywordflow">if</span> (Node-&gt;isDebugDataVisible())
162 Node-&gt;setDebugDataVisible(<a class="code" href="namespaceirr_1_1scene.html#a52b664c4c988113735042b168fc32dbea25111b15f03bee9a99498737286916dc" title="No Debug Data ( Default )">scene::EDS_OFF</a>);
163 <span class="keywordflow">else</span>
164 Node-&gt;setDebugDataVisible(<a class="code" href="namespaceirr_1_1scene.html#a52b664c4c988113735042b168fc32dbea80f38e42f1b8cf169e83f44092367bfe" title="EDS_BBOX | EDS_BBOX_BUFFERS.">scene::EDS_BBOX_ALL</a>);
165 }
166 }
167 <span class="keywordflow">return</span> <span class="keyword">false</span>;
168 }
169
170<span class="keyword">private</span>:
171 IrrlichtDevice *Device;
172 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> Number;
173 <a class="code" href="namespaceirr_1_1core.html#ade1071a878633f2f6d8a75c5d11fec19" title="Typedef for character strings.">core::stringc</a> FilenameTemplate;
174 ISceneNode* Node;
175};
176</pre></div><p>Ok, lets start. </p>
177<div class="fragment"><pre class="fragment"><span class="keywordtype">int</span> <a class="code" href="_irr_compile_config_8h.html#a3f9bf2240c47d3f99b86f83f9123aa9d">IRRCALLCONV</a> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[])
178{
179</pre></div><p>Like in the HelloWorld example, we create an IrrlichtDevice with <a class="el" href="namespaceirr.html#abaf4d8719cc26b0d30813abf85e47c76" title="Creates an Irrlicht device. The Irrlicht device is the root object for using the engine.">createDevice()</a>. The difference now is that we ask the user to select which hardware accelerated driver to use. The Software device would be too slow to draw a huge Quake 3 map, but just for the fun of it, we make this decision possible too. </p>
180<div class="fragment"><pre class="fragment"> <span class="comment">// ask user for driver</span>
181 <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0" title="An enum for all types of drivers the Irrlicht Engine supports.">video::E_DRIVER_TYPE</a> driverType=driverChoiceConsole();
182 <span class="keywordflow">if</span> (driverType==<a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0ae685cada50f8c100403134d932d0414c" title="No driver, just for counting the elements.">video::EDT_COUNT</a>)
183 <span class="keywordflow">return</span> 1;
184
185 <span class="comment">// create device and exit if creation failed</span>
186 <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#ad2e562e3219072e2f7fc7c2bba0ef0cb" title="Typedef for an unsigned integer dimension.">core::dimension2du</a> videoDim(800,600);
187
188 IrrlichtDevice *device = <a class="code" href="namespaceirr.html#abaf4d8719cc26b0d30813abf85e47c76" title="Creates an Irrlicht device. The Irrlicht device is the root object for using the engine.">createDevice</a>(driverType, videoDim, 32, <span class="keyword">false</span> );
189
190 <span class="keywordflow">if</span> (device == 0)
191 <span class="keywordflow">return</span> 1; <span class="comment">// could not create selected driver.</span>
192
193 <span class="keyword">const</span> <span class="keywordtype">char</span>* mapname=0;
194 <span class="keywordflow">if</span> (argc&gt;2)
195 mapname = argv[2];
196 <span class="keywordflow">else</span>
197 mapname = QUAKE3_MAP_NAME;
198</pre></div><p>Get a pointer to the video driver and the SceneManager so that we do not always have to write device-&gt;getVideoDriver() and device-&gt;getSceneManager(). </p>
199<div class="fragment"><pre class="fragment"> video::IVideoDriver* driver = device-&gt;getVideoDriver();
200 scene::ISceneManager* smgr = device-&gt;getSceneManager();
201 gui::IGUIEnvironment* gui = device-&gt;<a class="code" href="classirr_1_1scene_1_1_i_scene_manager.html#ad887536e9cc41d0670364f9f0a0f4510" title="Get the active GUIEnvironment.">getGUIEnvironment</a>();
202
203 device-&gt;getFileSystem()-&gt;addFileArchive(<span class="stringliteral">&quot;../../media/&quot;</span>);
204</pre></div><p>To display the Quake 3 map, we first need to load it. Quake 3 maps are packed into .pk3 files, which are nothing other than .zip files. So we add the .pk3 file to our FileSystem. After it was added, we are able to read from the files in that archive as they would directly be stored on disk. </p>
205<div class="fragment"><pre class="fragment"> <span class="keywordflow">if</span> (argc&gt;2)
206 device-&gt;getFileSystem()-&gt;QUAKE3_STORAGE_FORMAT(argv[1]);
207 <span class="keywordflow">else</span>
208 device-&gt;getFileSystem()-&gt;QUAKE3_STORAGE_FORMAT(QUAKE3_STORAGE_1);
209<span class="preprocessor">#ifdef QUAKE3_STORAGE_2</span>
210<span class="preprocessor"></span> device-&gt;getFileSystem()-&gt;QUAKE3_STORAGE_FORMAT(QUAKE3_STORAGE_2);
211<span class="preprocessor">#endif</span>
212<span class="preprocessor"></span>
213 <span class="comment">// Quake3 Shader controls Z-Writing</span>
214 smgr-&gt;getParameters()-&gt;setAttribute(<a class="code" href="namespaceirr_1_1scene.html#ab585d23bc2a3d02cd368d8bfd0b1414a" title="Name of the parameter for changing how Irrlicht handles the ZWrite flag for transparent (blending) ma...">scene::ALLOW_ZWRITE_ON_TRANSPARENT</a>, <span class="keyword">true</span>);
215</pre></div><p>Now we can load the mesh by calling getMesh(). We get a pointer returned to a IAnimatedMesh. As you know, Quake 3 maps are not really animated, they are only a huge chunk of static geometry with some materials attached. Hence the IAnimated mesh consists of only one frame, so we get the "first frame" of the "animation", which is our quake level and create an Octree scene node with it, using addOctreeSceneNode(). The Octree optimizes the scene a little bit, trying to draw only geometry which is currently visible. An alternative to the Octree would be a AnimatedMeshSceneNode, which would draw always the complete geometry of the mesh, without optimization. Try it out: Write addAnimatedMeshSceneNode instead of addOctreeSceneNode and compare the primitives drawn by the video driver. (There is a getPrimitiveCountDrawed() method in the IVideoDriver class). Note that this optimization with the Octree is only useful when drawing huge meshes consisting of lots of geometry. </p>
216<div class="fragment"><pre class="fragment"> scene::IQ3LevelMesh* <span class="keyword">const</span> mesh =
217 (scene::IQ3LevelMesh*) smgr-&gt;getMesh(mapname);
218</pre></div><p>add the geometry mesh to the Scene ( polygon &amp; patches ) The Geometry mesh is optimised for faster drawing </p>
219<div class="fragment"><pre class="fragment"> scene::ISceneNode* node = 0;
220 <span class="keywordflow">if</span> (mesh)
221 {
222 scene::IMesh * <span class="keyword">const</span> geometry = mesh-&gt;getMesh(<a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a44a1a489a965cc9a0ad2c235bbb7bf33a10a5968f2ec9c929bfbca721780a7ef6">quake3::E_Q3_MESH_GEOMETRY</a>);
223 node = smgr-&gt;addOctreeSceneNode(geometry, 0, -1, 4096);
224 }
225
226 <span class="comment">// create an event receiver for making screenshots</span>
227 CScreenShotFactory screenshotFactory(device, mapname, node);
228 device-&gt;setEventReceiver(&amp;screenshotFactory);
229</pre></div><p>now construct SceneNodes for each Shader The Objects are stored in the quake mesh scene::E_Q3_MESH_ITEMS and the Shader ID is stored in the MaterialParameters mostly dark looking skulls and moving lava.. or green flashing tubes? </p>
230<div class="fragment"><pre class="fragment"> <span class="keywordflow">if</span> ( mesh )
231 {
232 <span class="comment">// the additional mesh can be quite huge and is unoptimized</span>
233 <span class="keyword">const</span> scene::IMesh * <span class="keyword">const</span> additional_mesh = mesh-&gt;getMesh(<a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a44a1a489a965cc9a0ad2c235bbb7bf33a15b1dd0b29d69900d070346d61f44319">quake3::E_Q3_MESH_ITEMS</a>);
234
235<span class="preprocessor">#ifdef SHOW_SHADER_NAME</span>
236<span class="preprocessor"></span> gui::IGUIFont *font = device-&gt;getGUIEnvironment()-&gt;getFont(<span class="stringliteral">&quot;../../media/fontlucida.png&quot;</span>);
237 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> count = 0;
238<span class="preprocessor">#endif</span>
239<span class="preprocessor"></span>
240 <span class="keywordflow">for</span> ( <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> i = 0; i!= additional_mesh-&gt;getMeshBufferCount(); ++i )
241 {
242 <span class="keyword">const</span> IMeshBuffer* meshBuffer = additional_mesh-&gt;getMeshBuffer(i);
243 <span class="keyword">const</span> video::SMaterial&amp; material = meshBuffer-&gt;getMaterial();
244
245 <span class="comment">// The ShaderIndex is stored in the material parameter</span>
246 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> shaderIndex = (<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a>) material.MaterialTypeParam2;
247
248 <span class="comment">// the meshbuffer can be rendered without additional support, or it has no shader</span>
249 <span class="keyword">const</span> quake3::IShader *shader = mesh-&gt;getShader(shaderIndex);
250 <span class="keywordflow">if</span> (0 == shader)
251 {
252 <span class="keywordflow">continue</span>;
253 }
254
255 <span class="comment">// we can dump the shader to the console in its</span>
256 <span class="comment">// original but already parsed layout in a pretty</span>
257 <span class="comment">// printers way.. commented out, because the console</span>
258 <span class="comment">// would be full...</span>
259 <span class="comment">// quake3::dumpShader ( Shader );</span>
260
261 node = smgr-&gt;addQuake3SceneNode(meshBuffer, shader);
262
263<span class="preprocessor">#ifdef SHOW_SHADER_NAME</span>
264<span class="preprocessor"></span> count += 1;
265 <a class="code" href="namespaceirr_1_1core.html#aef83fafbb1b36fcce44c07c9be23a7f2" title="Typedef for wide character strings.">core::stringw</a> name( node-&gt;getName() );
266 node = smgr-&gt;addBillboardTextSceneNode(
267 font, name.c_str(), node,
268 core::dimension2d&lt;f32&gt;(80.0f, 8.0f),
269 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">core::vector3df</a>(0, 10, 0));
270<span class="preprocessor">#endif</span>
271<span class="preprocessor"></span> }
272 }
273</pre></div><p>Now we only need a Camera to look at the Quake 3 map. And we want to create a user controlled camera. There are some different cameras available in the Irrlicht engine. For example the Maya Camera which can be controlled comparable to the camera in Maya: Rotate with left mouse button pressed, Zoom with both buttons pressed, translate with right mouse button pressed. This could be created with addCameraSceneNodeMaya(). But for this example, we want to create a camera which behaves like the ones in first person shooter games (FPS). </p>
274<div class="fragment"><pre class="fragment"> scene::ICameraSceneNode* camera = smgr-&gt;addCameraSceneNodeFPS();
275</pre></div><p>so we need a good starting Position in the level. we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch" we choose a random launch </p>
276<div class="fragment"><pre class="fragment"> <span class="keywordflow">if</span> ( mesh )
277 {
278 <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a312f35a37540d810fcb14b75fd449c9e">quake3::tQ3EntityList</a> &amp;entityList = mesh-&gt;getEntityList();
279
280 <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a93ed78aeb11a2a7e8f8ae9b99801aba7">quake3::IEntity</a> search;
281 search.name = <span class="stringliteral">&quot;info_player_deathmatch&quot;</span>;
282
283 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> index = entityList.binary_search(search);
284 <span class="keywordflow">if</span> (index &gt;= 0)
285 {
286 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> notEndList;
287 <span class="keywordflow">do</span>
288 {
289 <span class="keyword">const</span> quake3::SVarGroup *group = entityList[index].getGroup(1);
290
291 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> parsepos = 0;
292 <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">core::vector3df</a> pos =
293 <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a6163d5a7fba9950a2f390a42fe354c3f" title="get a quake3 vector translated to irrlicht position (x,-z,y )">quake3::getAsVector3df</a>(group-&gt;get(<span class="stringliteral">&quot;origin&quot;</span>), parsepos);
294
295 parsepos = 0;
296 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> angle = <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#adca7fb6948f37384aca94a4c9ac73f14">quake3::getAsFloat</a>(group-&gt;get(<span class="stringliteral">&quot;angle&quot;</span>), parsepos);
297
298 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">core::vector3df</a> target(0.f, 0.f, 1.f);
299 target.rotateXZBy(angle);
300
301 camera-&gt;setPosition(pos);
302 camera-&gt;setTarget(pos + target);
303
304 ++index;
305</pre></div><p>notEndList = ( index &lt; (s32) entityList.size () &amp;&amp; entityList[index].name == search.name &amp;&amp; (device-&gt;getTimer()-&gt;getRealTime() &gt;&gt; 3 ) &amp; 1 ); </p>
306<div class="fragment"><pre class="fragment"> notEndList = index == 2;
307 } <span class="keywordflow">while</span> ( notEndList );
308 }
309 }
310</pre></div><p>The mouse cursor needs not to be visible, so we make it invisible. </p>
311<div class="fragment"><pre class="fragment"> device-&gt;getCursorControl()-&gt;setVisible(<span class="keyword">false</span>);
312
313 <span class="comment">// load the engine logo</span>
314 gui-&gt;addImage(driver-&gt;getTexture(<span class="stringliteral">&quot;irrlichtlogo2.png&quot;</span>),
315 core::position2d&lt;s32&gt;(10, 10));
316
317 <span class="comment">// show the driver logo</span>
318 <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#a3643c2cc7820dd78cd87e73a46b92145">core::position2di</a> pos(videoDim.Width - 128, videoDim.Height - 64);
319
320 <span class="keywordflow">switch</span> ( driverType )
321 {
322 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0ae85481da26159b967191ccc6de1e4a05" title="The Burning&#39;s Software Renderer, an alternative software renderer.">video::EDT_BURNINGSVIDEO</a>:
323 gui-&gt;addImage(driver-&gt;getTexture(<span class="stringliteral">&quot;burninglogo.png&quot;</span>), pos);
324 <span class="keywordflow">break</span>;
325 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0a2715182a79f1cb8e2826fd68a8150a53" title="OpenGL device, available on most platforms.">video::EDT_OPENGL</a>:
326 gui-&gt;addImage(driver-&gt;getTexture(<span class="stringliteral">&quot;opengllogo.png&quot;</span>), pos);
327 <span class="keywordflow">break</span>;
328 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0a8cc3807f6f28404f3424ad7e31b3142f" title="Direct3D8 device, only available on Win32 platforms.">video::EDT_DIRECT3D8</a>:
329 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0a4691ca314f9018f508dcf2c57dcaacec" title="Direct3D 9 device, only available on Win32 platforms.">video::EDT_DIRECT3D9</a>:
330 gui-&gt;addImage(driver-&gt;getTexture(<span class="stringliteral">&quot;directxlogo.png&quot;</span>), pos);
331 <span class="keywordflow">break</span>;
332 }
333</pre></div><p>We have done everything, so lets draw it. We also write the current frames per second and the drawn primitives to the caption of the window. The 'if (device-&gt;isWindowActive())' line is optional, but prevents the engine render to set the position of the mouse cursor after task switching when other program are active. </p>
334<div class="fragment"><pre class="fragment"> <span class="keywordtype">int</span> lastFPS = -1;
335
336 <span class="keywordflow">while</span>(device-&gt;run())
337 <span class="keywordflow">if</span> (device-&gt;isWindowActive())
338 {
339 driver-&gt;beginScene(<span class="keyword">true</span>, <span class="keyword">true</span>, video::SColor(255,20,20,40));
340 smgr-&gt;drawAll();
341 gui-&gt;drawAll();
342 driver-&gt;endScene();
343
344 <span class="keywordtype">int</span> fps = driver-&gt;getFPS();
345 <span class="comment">//if (lastFPS != fps)</span>
346 {
347 io::IAttributes * <span class="keyword">const</span> attr = smgr-&gt;getParameters();
348 <a class="code" href="namespaceirr_1_1core.html#aef83fafbb1b36fcce44c07c9be23a7f2" title="Typedef for wide character strings.">core::stringw</a> str = L<span class="stringliteral">&quot;Q3 [&quot;</span>;
349 str += driver-&gt;getName();
350 str += <span class="stringliteral">&quot;] FPS:&quot;</span>;
351 str += fps;
352<span class="preprocessor">#ifdef _IRR_SCENEMANAGER_DEBUG </span>
353<span class="preprocessor"></span> str += <span class="stringliteral">&quot; Cull:&quot;</span>;
354 str += attr-&gt;getAttributeAsInt(<span class="stringliteral">&quot;calls&quot;</span>);
355 str += <span class="stringliteral">&quot;/&quot;</span>;
356 str += attr-&gt;getAttributeAsInt(<span class="stringliteral">&quot;culled&quot;</span>);
357 str += <span class="stringliteral">&quot; Draw: &quot;</span>;
358 str += attr-&gt;getAttributeAsInt(<span class="stringliteral">&quot;drawn_solid&quot;</span>);
359 str += <span class="stringliteral">&quot;/&quot;</span>;
360 str += attr-&gt;getAttributeAsInt(<span class="stringliteral">&quot;drawn_transparent&quot;</span>);
361 str += <span class="stringliteral">&quot;/&quot;</span>;
362 str += attr-&gt;getAttributeAsInt(<span class="stringliteral">&quot;drawn_transparent_effect&quot;</span>);
363<span class="preprocessor">#endif</span>
364<span class="preprocessor"></span> device-&gt;setWindowCaption(str.c_str());
365 lastFPS = fps;
366 }
367 }
368</pre></div><p>In the end, delete the Irrlicht device. </p>
369<div class="fragment"><pre class="fragment"> device-&gt;drop();
370
371 <span class="keywordflow">return</span> 0;
372}
373</pre></div> </div></div>
374</div>
375 <div id="nav-path" class="navpath">
376 <ul>
377<!-- window showing the filter options -->
378<div id="MSearchSelectWindow"
379 onmouseover="return searchBox.OnSearchSelectShow()"
380 onmouseout="return searchBox.OnSearchSelectHide()"
381 onkeydown="return searchBox.OnSearchSelectKey(event)">
382<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>
383
384<!-- iframe showing the search results (closed by default) -->
385<div id="MSearchResultsWindow">
386<iframe src="javascript:void(0)" frameborder="0"
387 name="MSearchResults" id="MSearchResults">
388</iframe>
389</div>
390
391
392 <li class="footer">
393<a href="http://irrlicht.sourceforge.net" target="_blank">Irrlicht
394Engine</a> Documentation &copy; 2003-2012 by Nikolaus Gebhardt. Generated on Sun Nov 17 2013 20:18:41 for Irrlicht 3D Engine by
395<a href="http://www.doxygen.org/index.html" target="_blank">Doxygen</a> 1.7.5.1 </li>
396 </ul>
397 </div>
398
399
400</body>
401</html>