From f9158592e1478b2013afc7041d9ed041cf2d2f4a Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 13 Jan 2014 19:47:58 +1000 Subject: Update Irrlicht to 1.8.1. Include actual change markers this time. lol --- .../irrlicht-1.8/examples/02.Quake3Map/Makefile | 40 ---- .../examples/02.Quake3Map/Quake3Map.cbp | 55 ----- .../examples/02.Quake3Map/Quake3Map.dev | 59 ------ .../examples/02.Quake3Map/Quake3Map.vcproj | 162 -------------- .../examples/02.Quake3Map/Quake3Map_vc10.vcxproj | 231 -------------------- .../examples/02.Quake3Map/Quake3Map_vc11.vcxproj | 235 --------------------- .../examples/02.Quake3Map/Quake3Map_vc8.vcproj | 231 -------------------- .../examples/02.Quake3Map/Quake3Map_vc9.vcproj | 230 -------------------- .../irrlicht-1.8/examples/02.Quake3Map/main.cpp | 206 ------------------ .../examples/02.Quake3Map/tutorial.html | 181 ---------------- 10 files changed, 1630 deletions(-) delete mode 100644 libraries/irrlicht-1.8/examples/02.Quake3Map/Makefile delete mode 100644 libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.cbp delete mode 100644 libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.dev delete mode 100644 libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.vcproj delete mode 100644 libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc10.vcxproj delete mode 100644 libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc11.vcxproj delete mode 100644 libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc8.vcproj delete mode 100644 libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc9.vcproj delete mode 100644 libraries/irrlicht-1.8/examples/02.Quake3Map/main.cpp delete mode 100644 libraries/irrlicht-1.8/examples/02.Quake3Map/tutorial.html (limited to 'libraries/irrlicht-1.8/examples/02.Quake3Map') diff --git a/libraries/irrlicht-1.8/examples/02.Quake3Map/Makefile b/libraries/irrlicht-1.8/examples/02.Quake3Map/Makefile deleted file mode 100644 index 8929223..0000000 --- a/libraries/irrlicht-1.8/examples/02.Quake3Map/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# Makefile for Irrlicht Examples -# It's usually sufficient to change just the target name and source file list -# and be sure that CXX is set to a valid compiler -Target = 02.Quake3Map -Sources = main.cpp - -# general compiler settings -CPPFLAGS = -I../../include -I/usr/X11R6/include -CXXFLAGS = -O3 -ffast-math -#CXXFLAGS = -g -Wall - -#default target is Linux -all: all_linux - -ifeq ($(HOSTTYPE), x86_64) -LIBSELECT=64 -endif - -# target specific settings -all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -lXcursor -all_linux clean_linux: SYSTEM=Linux -all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -static_win32: LDFLAGS += -lgdi32 -lopengl32 -ld3dx9d -lwinmm -lm -static_win32: CPPFLAGS += -D_IRR_STATIC_LIB_ -static_win32 all_win32 clean_win32: SYSTEM=Win32-gcc -static_win32 all_win32 clean_win32: SUF=.exe -# name of the binary - only valid for targets which set SYSTEM -DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF) - -all_linux all_win32 static_win32: - $(warning Building...) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS) - -clean: clean_linux clean_win32 - $(warning Cleaning...) - -clean_linux clean_win32: - @$(RM) $(DESTPATH) - -.PHONY: all all_win32 clean clean_linux clean_win32 static_win32 diff --git a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.cbp b/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.cbp deleted file mode 100644 index 59f82ba..0000000 --- a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.cbp +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - diff --git a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.dev b/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.dev deleted file mode 100644 index 8bb989e..0000000 --- a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.dev +++ /dev/null @@ -1,59 +0,0 @@ -[Project] -FileName=example.dev -Name=Irrlicht Example 02 Quake3Map -UnitCount=1 -Type=1 -Ver=1 -ObjFiles= -Includes=..\..\include -Libs= -PrivateResource= -ResourceIncludes= -MakeIncludes= -Compiler= -CppCompiler= -Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_ -IsCpp=1 -Icon= -ExeOutput=../../bin/Win32-gcc -ObjectOutput=obj -OverrideOutput=1 -OverrideOutputName=02.Quake3Map.exe -HostApplication= -Folders= -CommandLine= -IncludeVersionInfo=0 -SupportXPThemes=0 -CompilerSet=0 -CompilerSettings=0000000000000000000000 -UseCustomMakefile=0 -CustomMakefile= - -[Unit1] -FileName=main.cpp -CompileCpp=1 -Folder=Projekt1 -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[VersionInfo] -Major=0 -Minor=1 -Release=1 -Build=1 -LanguageID=1033 -CharsetID=1252 -CompanyName= -FileVersion= -FileDescription=Irrlicht Engine example compiled using DevCpp and gcc -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion= -AutoIncBuildNr=0 - diff --git a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.vcproj b/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.vcproj deleted file mode 100644 index 53eb778..0000000 --- a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map.vcproj +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc10.vcxproj b/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc10.vcxproj deleted file mode 100644 index cdbc7d1..0000000 --- a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc10.vcxproj +++ /dev/null @@ -1,231 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - 02.Quake3Map - {D1A464A2-D479-458C-98A2-60965D823CD1} - Quake3Map - - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - ..\..\bin\Win32-VisualStudio\ - ..\..\bin\Win64-VisualStudio\ - - - ..\..\bin\Win32-VisualStudio\ - ..\..\bin\Win64-VisualStudio\ - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - - - - .\Debug/Quake3Map.tlb - - - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - - - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win32-VisualStudio\02.Quake3Map.exe - ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) - true - Console - - - - - - - .\Debug/Quake3Map.tlb - - - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - - - Level3 - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win64-VisualStudio\02.Quake3Map.exe - ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) - true - Console - - - - - - - .\Release/Quake3Map.tlb - - - - - MaxSpeed - OnlyExplicitInline - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreaded - true - - - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win32-VisualStudio\02.Quake3Map.exe - ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) - Console - - - - - - - .\Release/Quake3Map.tlb - - - - - MaxSpeed - OnlyExplicitInline - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreaded - true - - - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win64-VisualStudio\02.Quake3Map.exe - ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) - Console - - - - - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - - - \ No newline at end of file diff --git a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc11.vcxproj b/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc11.vcxproj deleted file mode 100644 index 98ea8bb..0000000 --- a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc11.vcxproj +++ /dev/null @@ -1,235 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - 02.Quake3Map - {D1A464A2-D479-458C-98A2-60965D823CD1} - Quake3Map - - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - ..\..\bin\Win32-VisualStudio\ - ..\..\bin\Win64-VisualStudio\ - - - ..\..\bin\Win32-VisualStudio\ - ..\..\bin\Win64-VisualStudio\ - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - - - - .\Debug/Quake3Map.tlb - - - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - - - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win32-VisualStudio\02.Quake3Map.exe - ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) - true - Console - - - - - - - .\Debug/Quake3Map.tlb - - - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - - - Level3 - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win64-VisualStudio\02.Quake3Map.exe - ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) - true - Console - - - - - - - .\Release/Quake3Map.tlb - - - - - MaxSpeed - OnlyExplicitInline - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreaded - true - - - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win32-VisualStudio\02.Quake3Map.exe - ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) - Console - - - - - - - .\Release/Quake3Map.tlb - - - - - MaxSpeed - OnlyExplicitInline - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreaded - true - - - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win64-VisualStudio\02.Quake3Map.exe - ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) - Console - - - - - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - - - \ No newline at end of file diff --git a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc8.vcproj b/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc8.vcproj deleted file mode 100644 index fdae474..0000000 --- a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc8.vcproj +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc9.vcproj b/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc9.vcproj deleted file mode 100644 index cc6c11c..0000000 --- a/libraries/irrlicht-1.8/examples/02.Quake3Map/Quake3Map_vc9.vcproj +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libraries/irrlicht-1.8/examples/02.Quake3Map/main.cpp b/libraries/irrlicht-1.8/examples/02.Quake3Map/main.cpp deleted file mode 100644 index 45b49aa..0000000 --- a/libraries/irrlicht-1.8/examples/02.Quake3Map/main.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/** Example 002 Quake3Map - -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. - -Please note that you should know the basics of the engine before starting this -tutorial. Just take a short look at the first tutorial, if you haven't done -this yet: http://irrlicht.sourceforge.net/tut001.html - -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. -*/ -#include -#include - -/* -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::'. There are 5 other sub -namespaces 'core', 'scene', 'video', 'io' and 'gui'. Unlike in the HelloWorld -example, we do not call 'using namespace' for these 5 other namespaces, because -in this way you will see what can be found in which namespace. But if you like, -you can also include the namespaces like in the previous example. -*/ -using namespace 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: -*/ -#ifdef _MSC_VER -#pragma comment(lib, "Irrlicht.lib") -#endif - -/* -Ok, lets start. Again, we use the main() method as start, not the WinMain(). -*/ -int main() -{ - /* - Like in the HelloWorld example, we create an IrrlichtDevice with - createDevice(). The difference now is that we ask the user to select - which video driver to use. The Software device might be - too slow to draw a huge Quake 3 map, but just for the fun of it, we make - this decision possible, too. - Instead of copying this whole code into your app, you can simply include - driverChoice.h from Irrlicht's include directory. The function - driverChoiceConsole does exactly the same. - */ - - // ask user for driver - - video::E_DRIVER_TYPE driverType; - - printf("Please select the driver you want for this example:\n"\ - " (a) OpenGL 1.5\n (b) Direct3D 9.0c\n (c) Direct3D 8.1\n"\ - " (d) Burning's Software Renderer\n (e) Software Renderer\n"\ - " (f) NullDevice\n (otherKey) exit\n\n"); - - char i; - std::cin >> i; - - switch(i) - { - case 'a': driverType = video::EDT_OPENGL; break; - case 'b': driverType = video::EDT_DIRECT3D9;break; - case 'c': driverType = video::EDT_DIRECT3D8;break; - case 'd': driverType = video::EDT_BURNINGSVIDEO;break; - case 'e': driverType = video::EDT_SOFTWARE; break; - case 'f': driverType = video::EDT_NULL; break; - default: return 1; - } - - // create device and exit if creation failed - - IrrlichtDevice *device = - createDevice(driverType, core::dimension2d(640, 480)); - - if (device == 0) - return 1; // could not create selected driver. - - /* - Get a pointer to the video driver and the SceneManager so that - we do not always have to call irr::IrrlichtDevice::getVideoDriver() and - irr::IrrlichtDevice::getSceneManager(). - */ - video::IVideoDriver* driver = device->getVideoDriver(); - scene::ISceneManager* smgr = device->getSceneManager(); - - /* - To display the Quake 3 map, we first need to load it. Quake 3 maps - are packed into .pk3 files which are nothing else than .zip files. - So we add the .pk3 file to our irr::io::IFileSystem. After it was added, - we are able to read from the files in that archive as if they are - directly stored on the disk. - */ - device->getFileSystem()->addFileArchive("../../media/map-20kdm2.pk3"); - - /* - Now we can load the mesh by calling - irr::scene::ISceneManager::getMesh(). We get a pointer returned to an - irr::scene::IAnimatedMesh. As you might know, Quake 3 maps are not - really animated, they are only a huge chunk of static geometry with - some materials attached. Hence the IAnimatedMesh 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 - irr::scene::ISceneManager::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 - irr::scene::IMeshSceneNode, which would always draw the complete - geometry of the mesh, without optimization. Try it: Use - irr::scene::ISceneManager::addMeshSceneNode() instead of - addOctreeSceneNode() and compare the primitives drawn by the video - driver. (There is a irr::video::IVideoDriver::getPrimitiveCountDrawn() - method in the irr::video::IVideoDriver class). Note that this - optimization with the Octree is only useful when drawing huge meshes - consisting of lots of geometry. - */ - scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp"); - scene::ISceneNode* node = 0; - - if (mesh) - node = smgr->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024); -// node = smgr->addMeshSceneNode(mesh->getMesh(0)); - - /* - Because the level was not modelled around the origin (0,0,0), we - translate the whole level a little bit. This is done on - irr::scene::ISceneNode level using the methods - irr::scene::ISceneNode::setPosition() (in this case), - irr::scene::ISceneNode::setRotation(), and - irr::scene::ISceneNode::setScale(). - */ - if (node) - node->setPosition(core::vector3df(-1300,-144,-1249)); - - /* - Now we only need a camera to look at the Quake 3 map. - We want to create a user controlled camera. There are some - cameras available in the Irrlicht engine. For example the - MayaCamera which can be controlled like 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 - irr::scene::ISceneManager::addCameraSceneNodeMaya(). But for this - example, we want to create a camera which behaves like the ones in - first person shooter games (FPS) and hence use - irr::scene::ISceneManager::addCameraSceneNodeFPS(). - */ - smgr->addCameraSceneNodeFPS(); - - /* - The mouse cursor needs not be visible, so we hide it via the - irr::IrrlichtDevice::ICursorControl. - */ - device->getCursorControl()->setVisible(false); - - /* - We have done everything, so lets draw it. We also write the current - frames per second and the primitives drawn into the caption of the - window. The test for irr::IrrlichtDevice::isWindowActive() is optional, - but prevents the engine to grab the mouse cursor after task switching - when other programs are active. The call to - irr::IrrlichtDevice::yield() will avoid the busy loop to eat up all CPU - cycles when the window is not active. - */ - int lastFPS = -1; - - while(device->run()) - { - if (device->isWindowActive()) - { - driver->beginScene(true, true, video::SColor(255,200,200,200)); - smgr->drawAll(); - driver->endScene(); - - int fps = driver->getFPS(); - - if (lastFPS != fps) - { - core::stringw str = L"Irrlicht Engine - Quake 3 Map example ["; - str += driver->getName(); - str += "] FPS:"; - str += fps; - - device->setWindowCaption(str.c_str()); - lastFPS = fps; - } - } - else - device->yield(); - } - - /* - In the end, delete the Irrlicht device. - */ - device->drop(); - return 0; -} - -/* -That's it. Compile and play around with the program. -**/ diff --git a/libraries/irrlicht-1.8/examples/02.Quake3Map/tutorial.html b/libraries/irrlicht-1.8/examples/02.Quake3Map/tutorial.html deleted file mode 100644 index 1b482f2..0000000 --- a/libraries/irrlicht-1.8/examples/02.Quake3Map/tutorial.html +++ /dev/null @@ -1,181 +0,0 @@ - - -Irrlicht Engine Tutorial - - - - -
- - - - - - - - -
- Tutorial 2.Quake3Map
-

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. Please note that you should know the basics - of the engine before starting this tutorial, just take a short look - at the first tutorial, 1.HelloWorld, if you haven't done this yet.
- The result of this example will look like this:

-


-

-
-
- - - - - - - -
- Lets start!
-

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.

- - - - -
#include <irrlicht.h>
#include <iostream>
-

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::'.
- There are 5 other sub namespaces 'core', 'scene', 'video', 'io' and - 'gui'. Unlike in the HelloWorld example, we do not a 'using namespace' - for these 5 other namespaces because in this way you will see what can - be found in which namespace. But if you like, you can also include the - namespaces like in the previous example. Code just like you want to.

- - - - -
using namespace 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:

- - - - -
#pragma comment(lib, "Irrlicht.lib")
- -
-

Ok, lets start. Again, we use the main() method as start, not the WinMain(), - because its shorter to write.

- - - - -
int main()
{
-

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.

- - - - -
// ask user for driver

video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9;

printf("Please select the driver you want for this example:\n"\
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
" (d) Software Renderer\n (e) Apfelbaum Software Renderer\n"\
" (f) NullDevice\n (otherKey) exit\n\n");
-char i;
std::cin >> i;

switch(i)
{
case 'a': driverType = video::EDT_DIRECT3D9;break;
case 'b': driverType = video::EDT_DIRECT3D8;break;
case 'c': driverType = video::EDT_OPENGL; break;
case 'd': driverType = video::EDT_SOFTWARE; break;
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break;
default: return 1;
}

// create device and exit if creation failed

IrrlichtDevice *device =
createDevice(driverType, core::dimension2d<s32>(640, 480));

if (device == 0)
return 1;
-

Get a pointer to the video driver and the SceneManager so that we do - not always have to write device->getVideoDriver() and device->getSceneManager().

- - - - -
video::IVideoDriver* driver = device->getVideoDriver();
-scene::ISceneManager* smgr = 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.

- - - - -
device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");
-

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 OctTree scene node with it, using addOctTreeSceneNode(). - The OctTree optimizes the scene a little bit, trying to draw only geometry - which is currently visible. An alternative to the OctTree would be a AnimatedMeshSceneNode, - which would draw always the complete geometry of the mesh, without optimization. - Try it out: Write addAnimatedMeshSceneNode instead of addOctTreeSceneNode - and compare the primitives drawed 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 consiting of lots of geometry.

- - - - -
scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* node = 0; - -if (mesh)
node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
-

Because the level was modelled not around the origin (0,0,0), we translate - the whole level a little bit.

- - - - -
if (node)
node->setPosition(core::vector3df(-1300,-144,-1249));
-

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,
- 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):

- - - - -
smgr->addCameraSceneNodeFPS();
-

The mouse cursor needs not to be visible, so we make it invisible.

- - - - -
device->getCursorControl()->setVisible(false);
-

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.

- - - - -
int lastFPS = -1;
-
while(device->run())
-{
-  driver->beginScene(true, true, video::SColor(0,200,200,200));
-  smgr->drawAll();
-  driver->endScene();
-
  int fps = driver->getFPS();
-
  if (lastFPS != fps)
-  {
-     core::stringw str = L"Irrlicht Engine - Quake 3 Map example [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps; - } -}
-

In the end, delete the Irrlicht device.

- - - - -
  device->drop();
return 0;
}
-

That's it. Compile and play around with the program.

-

 

-

 

- - -- cgit v1.1