<!-- Wanted to avoid copying .css to each folder, so copied default .css from doxyen in here, kicked out most stuff we don't need for examples and modified some a little bit.
Target was having a single html in each example folder which is created from the main.cpp files and needs no files besides some images below media folder.
This was Example 017 Helloworld mobile for WinCE 6. But WinCE6 support has been removed for Irrlicht 1.9. If you still need that please use Irrlicht 1.8 or svn revision 5045 which was the last one to include it.</p>
<p>Sources still kept for now as it compiles on other platform too. And we might use this example again once we support Windows RT. </p><divclass="fragment"><divclass="line"><spanclass="preprocessor">#include <irrlicht.h></span></div><divclass="line"></div><divclass="line"><spanclass="preprocessor">#if defined ( _IRR_WINDOWS_ )</span></div><divclass="line"><spanclass="preprocessor"> #include <windows.h></span></div><divclass="line"><spanclass="preprocessor">#endif</span></div><divclass="line"></div><divclass="line"><spanclass="keyword">using namespace </span>irr;</div><divclass="line"><spanclass="keyword">using namespace </span>core;</div><divclass="line"><spanclass="keyword">using namespace </span>scene;</div><divclass="line"><spanclass="keyword">using namespace </span>video;</div><divclass="line"><spanclass="keyword">using namespace </span>io;</div><divclass="line"><spanclass="keyword">using namespace </span>gui;</div><divclass="line"></div><divclass="line"><spanclass="preprocessor">#pragma comment(lib, "Irrlicht.lib")</span></div><divclass="line"></div><divclass="line"><spanclass="keyword">class </span>EventReceiver_basic : <spanclass="keyword">public</span> IEventReceiver</div><divclass="line">{</div><divclass="line"><spanclass="keyword">private</span>:</div><divclass="line"> IrrlichtDevice *Device;</div><divclass="line"><spanclass="keyword">public</span>:</div><divclass="line"> EventReceiver_basic ( IrrlichtDevice *device ): Device ( device ) {}</div><divclass="line"></div><divclass="line"><spanclass="keyword">virtual</span><spanclass="keywordtype">bool</span> OnEvent(<spanclass="keyword">const</span> SEvent& event)</div><divclass="line"> {</div><divclass="line"><spanclass="keywordflow">if</span> (event.EventType == EET_GUI_EVENT)</div><divclass="line"> {</div><divclass="line"> s32 <spanclass="keywordtype">id</span> = <spanclass="keyword">event</span>.GUIEvent.Caller->getID();</div><divclass="line"></div><divclass="line"><spanclass="keywordflow">switch</span>(event.GUIEvent.EventType)</div><divclass="line"> {</div><divclass="line"><spanclass="keywordflow">case</span> EGET_BUTTON_CLICKED:</div><divclass="line"><spanclass="keywordflow">if</span> (<spanclass="keywordtype">id</span> == 2)</div><divclass="line"> {</div><divclass="line"> Device->closeDevice();</div><divclass="line"><spanclass="keywordflow">return</span><spanclass="keyword">true</span>;</div><divclass="line"> } <spanclass="keywordflow">break</span>;</div><divclass="line"> }</div><divclass="line"> }</div><divclass="line"></div><divclass="line"><spanclass="keywordflow">return</span><spanclass="keyword">false</span>;</div><divclass="line"> }</div><divclass="line">};</div><divclass="line"></div><divclass="line"><spanclass="keyword">class </span>CSampleSceneNode : <spanclass="keyword">public</span> ISceneNode</div><divclass="line">{</div><divclass="line"> aabbox3d<f32> Box;</div><divclass="line"> S3DVertex Vertices[4];</div><divclass="line"> SMaterial Material;</div><divclass="line"><spanclass="keyword">public</span>:</div><divclass="line"></div><divclass="line"> CSampleSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 <spanclass="keywordtype">id</span>)</div><divclass="line"> : ISceneNode(parent, mgr, id)</div><divclass="line"> {</div><divclass="line"> Material.Wireframe = <spanclass="keyword">false</span>;</div><divclass="line"> Material.Lighting = <spanclass="keyword">false</span>;</div><divclass="line"></div><divclass="line"> Vertices[0] = S3DVertex(0,0,10, 1,1,0, SColor(255,0,255,255), 0, 1);</div><divclass="line"> Vertices[1] = S3DVertex(10,0,-10, 1,0,0, SColor(255,255,0,255), 1, 1);</div><divclass="line"> Vertices[2] = S3DVertex(0,20,0, 0,1,1, SColor(255,255,255,0), 1
<p>To make the terrain look more big, we change the scale factor of it to (40, 4.4, 40). Because we don't have any dynamic lights in the scene, we switch off the lighting, and we set the file terrain-texture.jpg as texture for the terrain and detailmap3.jpg as second texture, called detail map. At last, we set the scale values for the texture: The first texture will be repeated only one time over the whole terrain, and the second one (detail map) 20 times. </p><divclass="fragment"><divclass="line"><spanclass="comment">// add terrain scene node</span></div><divclass="line">scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode(</div><divclass="line"><spanclass="stringliteral">"../../media/terrain-heightmap.bmp"</span>,</div><divclass="line"> 0, <spanclass="comment">// parent node</span></div><divclass="line"> -1, <spanclass="comment">// node id</span></div><divclass="line"> core::vector3df(0.f, 0.f, 0.f), <spanclass="comment">// position</span></div><divclass="line"> core::vector3df(0.f, 0.f, 0.f), <spanclass="comment">// rotation</span></div><divclass="line"> core::vector3df(40.f, 4.4f, 40.f), <spanclass="comment">// scale</span></div><divclass="line"> video::SColor ( 255, 255, 255, 255 ), <spanclass="comment">// vertexColor</span></div><divclass="line"> 5, <spanclass="comment">// maxLOD</span></div><divclass="line"> scene::ETPS_17, <spanclass="comment">// patchSize</span></div><divclass="line"> 4 <spanclass="comment">// smoothFactor</span></div><divclass="line"> );</div><divclass="line"></div><divclass="line"><spanclass="keywordflow">if</span> ( terrain )</div><divclass="line">{</div><divclass="line"> terrain->setMaterialFlag(video::EMF_LIGHTING, <spanclass="keyword">false</span>);</div><divclass="line"></div><divclass="line"> terrain->setMaterialTexture(0,</div><divclass="line"> driver->getTexture(<spanclass="stringliteral">"../../media/terrain-texture.jpg"</span>));</div><divclass="line"> terrain->setMaterialTexture(1,</div><divclass="line"> driver->getTexture(<spanclass="stringliteral">"../../media/detailmap3.jpg"</span>));</div><divclass="line"></div><divclass="line"> terrain->setMaterialType(video::EMT_DETAIL_MAP);</div><divclass="line"></div><divclass="line"> terrain->scaleTexture(1.0f, 20.0f);</div><divclass="line"><spanclass="comment">//terrain->setDebugDataVisible ( true );</span></div></div><!-- fragment --><p> To be able to do collision with the terrain, we create a triangle selector. If you want to know what triangle selectors do, just take a look into the collision tutorial. The terrain triangle selector works together with the terrain. To demonstrate this, we create a collision response animator and attach it to the camera, so that the camera will not be able to fly through the terrain. </p><divclass="fragment"><divclass="line"><spanclass="comment">// create triangle selector for the terrain</span></div><divclass="line">scene::ITriangleSelector* selector</div><divclass="line"> = smgr->createTerrainTriangleSelector(terrain, 0);</div><divclass="line">terrain->setTriangleSelector(selector);</div><divclass="line"></div><divclass="line"><spanclass="comment">// create collision response animator and attach it to the camera</span></div><divclass="line">scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(</div><divclass="line"> selector, camera, core::vector3df(60,100,60),</div><divclass="line"> core::vector3df(0,0,0),</div><divclass="line"> core::vector3df(0,50,0));</div><divclass="line">selector->drop();</div><divclass="line">camera->addAnimator(anim);</div><divclass="line">anim->drop();</div></div><!-- fragment --><p> If you need access to the terrain data you can also do this directly via the following code fragment. </p><divclass="fragment"><divclass="line"> scene::CDyn