- Lets start! |
- |||||||||||||
-
- Lets start like the HelloWorld example: We include the irrlicht header
- files and an additional file to be able
As already written in the HelloWorld example, in the Irrlicht Engine,
- everything can be found in the namespace 'irr'. To get rid of the irr::
- in front of the name of every class, we tell the compiler that we use
- that namespace from now on, and we will not have to write that 'irr::'.
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: -
Ok, lets start. Again, we use the main() method as start, not the WinMain(), - because its shorter to write. -
Like in the HelloWorld example, we create an IrrlichtDevice with createDevice(). - 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. -
Get a pointer to the video driver and the SceneManager so that we do - not always have to write device->getVideoDriver() and device->getSceneManager(). -
To display the Quake 3 map, we first need to load it. Quake 3 maps are - packed into .pk3 files wich 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. -
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,
Because the level was modelled not around the origin (0,0,0), we translate - the whole level a little bit. -
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
- compareable to the camera in Maya: Rotate with left mouse button pressed,
- Zoom with both buttons pressed,
The mouse cursor needs not to be visible, so we make it invisible. -
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->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. -
In the end, delete the Irrlicht device. -
That's it. Compile and play around with the program. |
-
-
- - + + +
+ Lets start! |
+ |||||||||||||
+
+ Lets start like the HelloWorld example: We include the irrlicht header
+ files and an additional file to be able
As already written in the HelloWorld example, in the Irrlicht Engine,
+ everything can be found in the namespace 'irr'. To get rid of the irr::
+ in front of the name of every class, we tell the compiler that we use
+ that namespace from now on, and we will not have to write that 'irr::'.
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: +
Ok, lets start. Again, we use the main() method as start, not the WinMain(), + because its shorter to write. +
Like in the HelloWorld example, we create an IrrlichtDevice with createDevice(). + 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. +
Get a pointer to the video driver and the SceneManager so that we do + not always have to write device->getVideoDriver() and device->getSceneManager(). +
To display the Quake 3 map, we first need to load it. Quake 3 maps are + packed into .pk3 files wich 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. +
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,
Because the level was modelled not around the origin (0,0,0), we translate + the whole level a little bit. +
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
+ compareable to the camera in Maya: Rotate with left mouse button pressed,
+ Zoom with both buttons pressed,
The mouse cursor needs not to be visible, so we make it invisible. +
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->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. +
In the end, delete the Irrlicht device. +
That's it. Compile and play around with the program. |
+
+
+ + -- cgit v1.1