Tutorial 1.HelloWorld | + +
+ This Tutorial shows how to set up the IDE for using the
+ Irrlicht Engine and how to write a simple HelloWorld program
+ with it. The program will show how to use the basics of
+ the VideoDriver, the GUIEnvironment and the SceneManager.
|
+
+
Lets start! | +|||||||||||||||
+
+
+
+
+
+
+ After we have set up the IDE, the compiler will know + where to find the Irrlicht Engine header files so + we can include it now into our code. +
In the Irrlicht Engine, everything can be found in + the namespace 'irr'. So if you want to use a class + of the engine, you'll have to type an irr:: before + the name of the class. For example, to use the IrrlichtDevice, + write: irr::IrrlichtDevice. To avoid having to put + irr:: before of the name of every class, we tell the + compiler that we use that namespace. +
There are 5 sub-namespaces in the Irrlicht Engine. + Take a look at them: you can read a detailed description + of them in the documentation by clicking on the top + menu item 'Namespace + List'. To keep this example simple, we don't want + to have to specify the name spaces, Hence: +
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: +
Now the main method: to keep this example simple + we use int main(), which can be used on any platform. + However, on Windows platforms, we could also use the + WinMain method if we would want to get rid of the + console window which pops up when starting a program + with main(). +
The most important function of the engine is the + 'createDevice' function. The Irrlicht Device, which + is the root object for doing everything with the engine, + can be created with it. createDevice() has 7 parameters: +
Now we set the caption of the window to some nice text. + Note that there is a 'L' in front of the string: the + Irrlicht Engine uses wide character strings when displaying + text. +
Now we store a pointer to the video driver, the SceneManager, + and the graphical user interface environment so that + we do not always have to write device->getVideoDriver(), + device->getSceneManager(), and device->getGUIEnvironment(). +
We add a hello world label to the window using the + GUI environment. The text is placed at the position + (10,10) as top left corner and (200,22) as lower right + corner. +
To display something interesting, we load a Quake 2
+ model and display it. We only have to get the Mesh from
+ the Scene Manager with getMesh() and add a SceneNode
+ to display the mesh with addAnimatedMeshSceneNode().
+ Instead of loading a Quake2 file (.md2), it is also
+ possible to load a Maya object file (.obj), a complete
+ Quake3 map (.bsp), or a Milshape file (.ms3d).
To make the mesh look a little bit nicer, we change + its material a little bit: we disable lighting because + we do not have a dynamic light in here and the mesh + would be totally black. Then we set the frame loop so + that the animation is looped between the frames 0 and + 310. Then, at last, we apply a texture to the mesh. + Without it the mesh would be drawn using only a solid + color. +
To look at the mesh, we place a camera into 3d space + at the position (0, 10, -40). The camera looks from + there to (0,5,0). +
Ok. Now that we have set up the scene, let's draw everything: + we run the device in a while() loop until the device + does not want to run any more. This would be when the + user closes the window or presses ALT+F4 in Windows. +
Everything must be drawn between a beginScene() and + an endScene() call. The beginScene clears the screen + with a color and also the depth buffer, if desired. + Then we let the Scene Manager and the GUI environment + draw their content. With the endScene() call, everything + is presented on the screen. +
After we are finished, we have to delete the Irrlicht + Device created earlier with createDevice(). With the + Irrlicht Engine, you should delete all objects you created + with a method or function that starts with 'create'. + The object is deleted simply by calling ->drop(). + See the documentation + for more information. +
That's it. Compile and run. ++ |
+
Possible Errors + or Problems | +|||||
+
+
+
+
+ Visual Studio
Solution: You may have set the include directory improperly + in the Visual Studio options. See above + for information on setting it. + +
Solution: You may have set the library directory improperly.
+ See above for information on
+ setting it. Compiler independent problems
Solution: You may have forgotten to copy the Irrlicht.dll + file from Irrlicht\bin\VisualStudio to the directory + the tutorial's project file is in. + If the tutorial compiles and runs successfully but produces + errors in the console like:+ +
Or: +
Solution: The file listed in the error message cannot
+ be found. Ensure that the directory specified in the
+ main.cpp exists and is where the file is located. |
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/02.Quake3Map/Makefile b/src/others/irrlicht-1.8.1/examples/02.Quake3Map/Makefile new file mode 100644 index 0000000..09953cf --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/02.Quake3Map/Makefile @@ -0,0 +1,40 @@ +# 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/src/others/irrlicht-1.8.1/examples/02.Quake3Map/Quake3Map.cbp b/src/others/irrlicht-1.8.1/examples/02.Quake3Map/Quake3Map.cbp new file mode 100644 index 0000000..59f82ba --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/02.Quake3Map/Quake3Map.cbp @@ -0,0 +1,55 @@ + +
+ 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. |
+
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/03.CustomSceneNode/CustomSceneNode.cbp b/src/others/irrlicht-1.8.1/examples/03.CustomSceneNode/CustomSceneNode.cbp new file mode 100644 index 0000000..e68ffd3 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/03.CustomSceneNode/CustomSceneNode.cbp @@ -0,0 +1,58 @@ + +
+ Lets start! |
+ ||||||||||||
+
+ To start, I include the header files, use the irr namespace, and tell + the linker to link with the .lib file. +
Here comes the most sophisticated part of this tutorial: The class
+ of our very own custom scene node. To keep it simple, To let our scene node be able to be inserted into the Irrlicht Engine + scene, the class we create needs only be derived from the ISceneNode + class and has to override some methods. +
First, we declare some member variables, to hold data for our tetraeder:
+ The bounding box, 4 vertices, and
The parameters of the constructor specify the parent of the scene node, + a pointer to the scene manager, and an id of the scene node. In the + constructor itself, we call the parent classes constructor, set some + properties of the material we use to draw the scene node and create + the 4 vertices of the tetraeder we will draw later. +
+ The Irrlicht Engine needs to know the bounding box of your scene node. + It will use it for doing automatic culling and other things. Hence we + need to create a bounding box from the 4 vertices we use. If you do not + want the engine to use the box for automatic culling, and/or don't want + to create the box, you could also write + AutomaticCullingEnabled = false;. + +
+ Before it is drawn, the OnPreRender() method of every scene node in
+ the scene is called by the scene manager. If the scene node wishes to
+ draw itself, it may register itself in the scene manager to be drawn.
+ This is necessary to tell the scene manager when it should call the
+ ::render method. For example normal scene nodes render their content
+ one after another, while stencil buffer shadows would like to be drawn
+ after all other scene nodes. And camera or light scene nodes need to
+ be rendered before all other scene nodes (if at all).
In the render() method most of the interresting stuff happenes: The Scene + node renders itself. We override this method and draw the tetraeder. +
At least, we create three small additional methods. GetBoundingBox()
+ returns the bounding box of this scene node,
That's it. The Scene node is done. Now we simply have to start the engine, + create the scene node and a camera, and look at the result. +
Create our scene node. Note that it is dropped (->drop()) instantly + after we create it. This is possible because the scene manager now takes + care of it. This is not nessecary, it would also be possible to drop it + at the end of the program. +
To animate something in this boring scene consisting only of one tetraeder, + and to show, that you now can use your scene node like any other scene + node in the engine, we add an animator to the scene node, which rotates + the node a little bit. +
Now draw everything and finish. +
That's it. Compile and play around with the program. |
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/04.Movement/Makefile b/src/others/irrlicht-1.8.1/examples/04.Movement/Makefile new file mode 100644 index 0000000..0dcd252 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/04.Movement/Makefile @@ -0,0 +1,39 @@ +# 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 = 04.Movement +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 -lopengl32 -lm +all_win32: CPPFLAGS += -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL +all_win32 clean_win32: SYSTEM=Win32-gcc +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: + $(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 diff --git a/src/others/irrlicht-1.8.1/examples/04.Movement/Movement.cbp b/src/others/irrlicht-1.8.1/examples/04.Movement/Movement.cbp new file mode 100644 index 0000000..0fcc4d0 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/04.Movement/Movement.cbp @@ -0,0 +1,55 @@ + +
+ Lets start! |
+ |||||||||||
+
+ As always, I include the header files, use the irr namespace, and tell + the linker to link with the .lib file. +
In this tutorial, one of our goals is to move a scene node using some
+ keys on the keyboard. We store a pointer to the scene node we want to
+ move with the keys here.
To get events like mouse and keyboard input, or GUI events like "the + OK button has been clicked", we need an object wich is derived + from the IEventReceiver object. There is only one method to override: + OnEvent. This method will be called by the engine when an event happened. + We will use this input to move the scene node with the keys W and S. +
If the key 'W' or 'S' was left up, we get the position of the scene + node, and modify the Y coordinate a little bit. So if you press 'W', + the node moves up, and if you press 'S' it moves down. +
The event receiver for moving a scene node is ready. So lets just create + an Irrlicht Device and the scene node we want to move. We also create + some other additional scene nodes, to show that there are also some different + possibilities to move and animate scene nodes. +
Create the node for moving it with the 'W' and 'S' key. We create a + sphere node, which is a built in geometric primitive scene node. + We place the node at (0,0,30) and assign a texture to it to let it look + a little bit more interesting. +
Now we create another node, moving using a scene node animator. Scene
+ node animators modify scene nodes and can be attached to any scene node
+ like
The last scene node we add to show possibilities of scene node animators + is a md2 model, which uses a 'fly straight' animator to run between to + points. +
To make to model look right we set the frames between which
+ the animation should loop, rotate the model around 180 degrees, and adjust
+ the animation speed and the texture.
To be able to look at and move around in this scene, we create a first + person shooter style camera and make the mouse cursor invisible. +
We have done everything, so lets draw it. We also write the current frames + per second and the name of the driver to the caption of the window. +
That's it. Compile and play around with the program. +
|
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/05.UserInterface/Makefile b/src/others/irrlicht-1.8.1/examples/05.UserInterface/Makefile new file mode 100644 index 0000000..24cd5d4 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/05.UserInterface/Makefile @@ -0,0 +1,38 @@ +# 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 = 05.UserInterface +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 -lopengl32 -lm +all_win32 clean_win32: SYSTEM=Win32-gcc +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: + $(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 diff --git a/src/others/irrlicht-1.8.1/examples/05.UserInterface/UserInterface.cbp b/src/others/irrlicht-1.8.1/examples/05.UserInterface/UserInterface.cbp new file mode 100644 index 0000000..0e4aebb --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/05.UserInterface/UserInterface.cbp @@ -0,0 +1,55 @@ + +
+ Lets start! |
+ ||||||||||
+
+ As always, we include the header files (conio and curses for getting + user input from the console), and use the irrlicht namespaces. We also + store a pointer to the Irrlicht device, a counter variable for changing + the creation position of a window, and a pointer to a listbox. +
The Event Receiver is not only capable of getting keyboard and mouse
+ input events, but also events of the graphical user interface (gui).
+ There are events for almost everything: Button click, Listbox selection
+ change, events that say that a element was hovered and so on. To be
+ able to react to some of these events, we create
If a scrollbar changed its scroll position, and it is 'our' scrollbar
+ (the one with id 104), then we change the
If a button was clicked, it could be one of 'our' three buttons. If
+ it is the first, we shut down the engine.
Ok, now for the more interesting part. First, create the Irrlicht device. + As in some examples before, we ask the user which driver he wants to + use for this example: +
The creation was successful, now we set the event receiver and store + pointers to the driver and to the gui environment. +
We add three buttons. The first one closes the engine. The second creates + a window and the third opens a file open dialog. The third parameter is + the id of the button, with which we can easily identify the button in + the event receiver. +
Now, we add a static text and a scrollbar, which modifies the transparency
+ of all gui elements. We set the maximum value of the scrollbar to 255,
+ because that's the maximal value for a color value.
+ To make the font a little bit nicer, we load an external font and set it + as new font in the skin. An at last, we create a nice Irrlicht Engine logo + in the top left corner. + +
That's all, we only have to draw everything. +
|
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/06.2DGraphics/2DGraphics.cbp b/src/others/irrlicht-1.8.1/examples/06.2DGraphics/2DGraphics.cbp new file mode 100644 index 0000000..0433c93 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/06.2DGraphics/2DGraphics.cbp @@ -0,0 +1,55 @@ + +
+ Lets start! |
+ |||||||||
+
+ As always, I include the header files, use the irr namespace, and tell + the linker to link with the .lib file. +
At first, we let the user select the driver type, then start up the + engine, set a caption, and get a pointer to the video driver. +
All 2d graphics in this example are put together into one texture, + 2ddemo.bmp. Because we want to draw colorkey based sprites, we need + to load this texture and tell the engine, which part of it should be + transparent based on a colorkey. In this example, we don't tell it the + color directly, we just say "Hey Irrlicht Engine, you'll find the + color I want at position (0,0) on the texture.". Instead, it would + be also possible to call driver->makeColorKeyTexture(images, + video::SColor(0,0,0,0)), to make e.g. all black pixels transparent. + Please note, that makeColorKeyTexture just creates an alpha channel + based on the color. +
To be able to draw some text with two different fonts, we load them.
+ Ok, we load just one, as first font we just use the default font which
+ is built into the engine.
Everything is prepared, now we can draw everything in the draw loop, + between the begin scene and end scene calls. In this example, we are + just doing 2d graphics, but it would be no problem to mix them with + 3d graphics. Just try it out, and draw some 3d vertices or set up a + scene with the scene manager and draw it. +
First, we draw 3 sprites, using the alpha channel we created with makeColorKeyTexture. + The last parameter specifiys that the drawing method should use thiw alpha + channel. The parameter before the last one specifies a color, with wich + the sprite should be colored. (255,255,255,255) is full white, so the + sprite will look like the original. The third sprite is drawed colored + based on the time. +
Drawing text is really simple. The code should be self explanatory. +
At last, we draw the Irrlicht Engine logo (without using a color or an + alpha channel) and a transparent 2d Rectangle at the position of the mouse + cursor. +
That's all, it was not really difficult, I hope. +
|
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/07.Collision/Collision.cbp b/src/others/irrlicht-1.8.1/examples/07.Collision/Collision.cbp new file mode 100644 index 0000000..0d7f828 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/07.Collision/Collision.cbp @@ -0,0 +1,55 @@ + +
+ Lets start! |
+ ||||||||
+
+
+
+ To start, we take the program from tutorial 2, which loaded and displayed + a quake 3 level. We will use the level to walk in it and to pick triangles + from it. In addition we'll place 3 animated models into it for scene + node picking. The following code starts up the engine and loads a + quake 3 level. I will not explain it, because it should already be + known from tutorial 2. +
So far so good, we've loaded the quake 3 level like in tutorial
+ 2. Now, here comes something different: We create a triangle selector.
+ A triangle selector is a class which can fetch the triangles from
+ scene nodes for doing different things with them, for example collision
+ detection. There are different triangle selectors, and all can be
+ created with the ISceneManager. In this example, we create an OctTreeTriangleSelector,
+ which optimizes the triangle output a little bit by reducing it like
+ an octree. This is very useful for huge meshes like quake 3 levels.
We add a first person shooter camera to the scene for being able
+ to move in the quake 3 level like in tutorial 2. But this, time, we
+ add a special animator to the camera: A Collision Response animator.
+ This thing modifies the scene node to which it is attached to in that
+ way, that it may no more move through walls and is affected by gravity.
+ The only thing we have to tell the animator is how the world looks
+ like, how big the scene node is, how gravity and so on. After the
+ collision response animator is attached to the camera, we do not have
+ to do anything more for collision detection, anything is done automaticly,
+ all other collision detection code below is for picking. And please
+ note another cool feature: The collsion response animator can be attached
+ also to all other scene nodes, not only to cameras. And it can be
+ mixed with other scene node animators. In this way, collision detection
+ and response in the Irrlicht
Because collision detection is no big deal in irrlicht, I'll describe
+ how to do two different types of picking in the next section. But
+ before this, I'll prepare the scene a little. I need three animated
+ characters which we
For not making it to complicated, I'm doing picking inside the drawing + loop. We take two pointers for storing the current and the last selected + scene node and start the loop. +
After we've drawn the whole scene whit smgr->drawAll(), we'll do + the first picking: We want to know which triangle of the world we are + looking at. In addition, we want the exact point of the quake 3 level + we are looking at. For this, we create a 3d line starting at the position + of the camera and going through the lookAt-target of it. Then we ask + the collision manager if this line collides with a triangle of the world + stored in the triangle selector. If yes, we draw the 3d triangle and + set the position of the billboard to the intersection point. +
Another type of picking supported by the Irrlicht Engine is scene
+ node picking based on bouding boxes. Every scene node has got a bounding
+ box, and because of that, it's very fast for example to get the scene
+ node which the camera looks
That's it, we just have to finish drawing. +
+ + |
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/08.SpecialFX/Makefile b/src/others/irrlicht-1.8.1/examples/08.SpecialFX/Makefile new file mode 100644 index 0000000..05b68ec --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/08.SpecialFX/Makefile @@ -0,0 +1,38 @@ +# 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 = 08.SpecialFX +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 -lopengl32 -lm +all_win32 clean_win32: SYSTEM=Win32-gcc +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: + $(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 diff --git a/src/others/irrlicht-1.8.1/examples/08.SpecialFX/SpecialFX.cbp b/src/others/irrlicht-1.8.1/examples/08.SpecialFX/SpecialFX.cbp new file mode 100644 index 0000000..05243f4 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/08.SpecialFX/SpecialFX.cbp @@ -0,0 +1,54 @@ + +
Lets start! | +|||||||
+
+
+
+ We start like in some tutorials before. Please note that this time, + the 'shadows' flag in createDevice() is set to true, for we want to + have a dynamic shadow casted from an animated character. If your this + example runs to slow, set it to false. The Irrlicht Engine checks + if your hardware doesn't support the stencil buffer, and disables + shadows by itself, but just in case the demo runs slow on your hardware. +
For our environment, we load a .3ds file. It is a small room I modelled
+ with Anim8or and exported it into the 3ds format because the Irrlicht
+ Engine did not support the .an8 format when I wrote this tutorial.
+ I am a very bad 3d graphic artist, and so the texture mapping is not
+ very nice in this model. Luckily I am a better programmer than artist,
+ and so the Irrlicht Engine is able to create a cool texture mapping
+ for me: Just use the mesh manipulator and create a planar texture
+ mapping for the mesh. If you want to see the mapping I made with Anim8or,
+ uncomment this line. I also did not figure out how to
Now, for the first special effect: Animated water. It works like + this: The WaterSurfaceSceneNode takes a mesh as input and makes it + wave like a water surface. And if we let this scene node use a nice + material like the MT_REFLECTION_2_LAYER, it looks really cool. We + are doing this with the next few lines of code. As input mesh, we + create a hill plane mesh, without hills. But any other mesh could + be used for this, you could even use the room.3ds (which would look + really strange) if you wanted to. +
The second special effect is very basic, I bet you saw it already + in some Irrlicht Engine demos: A transparent billboard combined with + a dynamic light. We simply create a light scene node, let it fly around, + an to make it look more cool, we attach a billboard scene node to + it. +
The next special effect is a lot more interesting: A particle system.
+ The particle system in the Irrlicht Engine is quit modular and extensible
+ and yet easy to use. There is a particle system scene node into which
+ you can put particle emitters, which make particles come out of nothing.
+ These emitters are quite flexible and usually have lots of parameters
+ like direction, amount and color of the particles they should create. Because only with emitters particle system would be a little bit
+ boring, there are particle affectors, which modify particles during
+ they fly around. They can be added to the particle system, simulating
+ additional effects like gravity or wind. The particle affector we
+ use in this example is an affector, which modifies the color of the
+ particles: It lets them fade out. Like the particle emitters, additional
+ particle affectors can also be implemented by you, simply derive a
+ class from IParticleAffector and add it with addAffector(). After
+ we set a nice material to the particle system, we have a cool looking
+ camp fire. By adjusting material, texture, particle emitter and affector
+ parameters, it is also easily possible to create smoke, rain, explosions,
+ snow, and so on.
As our last special effect, we want a dynamic shadow be casted from
+ an animated character. For this we load a DirectX .x model and place
+ it into our world. For creating the shadow, we simply need to call addShadowVolumeSceneNode().
+ The color of shadows is only adjustable globally for all shadows, by
+ calling ISceneManager::setShadowColor(). Voila, here is our dynamic
+ shadow.
Finally we simply have to draw everything, that's all. +
+ + + |
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/09.Meshviewer/9.Meshviewer.rc b/src/others/irrlicht-1.8.1/examples/09.Meshviewer/9.Meshviewer.rc new file mode 100644 index 0000000..3208583 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/09.Meshviewer/9.Meshviewer.rc @@ -0,0 +1,84 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// German (Austria) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEA) +#ifdef _WIN32 +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "icon.ico" +#endif // German (Austria) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/others/irrlicht-1.8.1/examples/09.Meshviewer/Makefile b/src/others/irrlicht-1.8.1/examples/09.Meshviewer/Makefile new file mode 100644 index 0000000..99fe9d0 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/09.Meshviewer/Makefile @@ -0,0 +1,38 @@ +# 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 = 09.Meshviewer +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 -lopengl32 -lm +all_win32 clean_win32: SYSTEM=Win32-gcc +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: + $(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 diff --git a/src/others/irrlicht-1.8.1/examples/09.Meshviewer/MeshViewer.dev b/src/others/irrlicht-1.8.1/examples/09.Meshviewer/MeshViewer.dev new file mode 100644 index 0000000..47416a1 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/09.Meshviewer/MeshViewer.dev @@ -0,0 +1,59 @@ +[Project] +FileName=example.dev +Name=Irrlicht Example 09 Mesh Viewer +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=09.MeshViewer.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/src/others/irrlicht-1.8.1/examples/09.Meshviewer/Meshviewer.cbp b/src/others/irrlicht-1.8.1/examples/09.Meshviewer/Meshviewer.cbp new file mode 100644 index 0000000..4600ffd --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/09.Meshviewer/Meshviewer.cbp @@ -0,0 +1,55 @@ + +
Lets start! | +|||||||||||
+
+
+
+ We start like in most other tutorials: Include all nesessary header + files, add a comment to let the engine be linked with the right .lib + file in Visual Studio, and deklare some global variables. We also + add two 'using namespece' statements, so we do not need to write the + whole names of all classes. In this tutorial, we use a lot stuff from + the gui namespace. +
The three following functions do several stuff used by the mesh + viewer. The first function showAboutText() simply displays a messagebox + with a caption and a message text. The texts will be stored in the + MessageText and Caption variables at startup. +
The second function loadModel() loads a model and displays it using + an addAnimatedMeshSceneNode and the scene manager. Nothing difficult. + It also displays a short message box, if the model could not be loaded. + +
Finally, the third function creates a toolbox window. In this simple + mesh viewer, this toolbox only contains a tab control with three edit + boxes for changing the scale of the displayed model. +
To get all the events sent by the GUI Elements, we need to create + an event receiver. This one is really simple. If an event occurs, + it checks the id of the caller and the event type, and starts an action + based on these values. For example, if a menu item with id 100 was + selected, if opens a file-open-dialog. +
Most of the hard work is done. We only need to create the Irrlicht + Engine device and all the buttons, menus and toolbars. We start up the + engine as usual, using createDevice(). To make our application catch + events, we set our eventreceiver as parameter. The #ifdef WIN32 preprocessor + commands are not necesarry, but I included them to make the tutorial + use DirectX on Windows and OpenGL on all other platforms like Linux. + As you can see, there is also a unusual call to IrrlichtDevice::setResizeAble(). + This makes the render window resizeable, which is quite useful for a + mesh viewer. +
The next step is to read the configuration file. It is stored in the
+ xml format and looks a little bit like this:
That wasn't difficult. Now we'll set a nicer font and create the Menu. + It is possible to create submenus for every menu item. The call menu->addItem(L"File", + -1, true, true); for example adds a new menu Item with the name "File" + and the id -1. The following parameter says that the menu item should + be enabled, and the last one says, that there should be a submenu. The + submenu can now be accessed with menu->getSubMenu(0), because the + "File" entry is the menu item with index 0. +
+ We want a toolbar, onto which we can place colored buttons and important + looking stuff like a senseless combobox. + +
+ To make the editor look a little bit better, we disable transparent gui + elements, and add a Irrlicht Engine logo. In addition, a text, which will + show the current frame per second value is created, and the window caption + changed. + +
+ That's nearly the whole application. We simply show the about message + box at start up, and load the first model. To make everything look better, + a skybox is created and a user controled camera, to make the application + a little bit more interactive. Finally, everything is drawed in a standard + drawing loop. + +
+ Compile and run this, and you have a fully functional 3d Mesh viewer. + |
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/10.Shaders/Makefile b/src/others/irrlicht-1.8.1/examples/10.Shaders/Makefile new file mode 100644 index 0000000..ff2df2a --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/10.Shaders/Makefile @@ -0,0 +1,38 @@ +# 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 = 10.Shaders +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 -lopengl32 -lm +all_win32 clean_win32: SYSTEM=Win32-gcc +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: + $(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 diff --git a/src/others/irrlicht-1.8.1/examples/10.Shaders/Shaders.cbp b/src/others/irrlicht-1.8.1/examples/10.Shaders/Shaders.cbp new file mode 100644 index 0000000..ec37b22 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/10.Shaders/Shaders.cbp @@ -0,0 +1,56 @@ + +
Lets start! | +|||||||||||
+
+
+
+ At first, we need to include all headers and do the stuff we always + do, like in nearly all other tutorials: +
Because we want to use some interesting shaders in this tutorials,
+ we need to set some data for them to make them able to compute nice
+ colors. In this example, we'll use a simple vertex shader which will
+ calculate the color of the vertex based on the position of the camera.
+ For this, the shader needs the following data: The inverted world
+ matrix for transforming the normal, the clip matrix for transforming
+ the position, the camera position and the world position of the object
+ for the calculation of the angle of light, and the color of the light.
+ To be able to tell the shader all this data every frame, we have to
+ derive a class from the IShaderConstantSetCallBack interface and override
+ its only method, namely OnSetConstants(). This method will be called
+ every time the material is set.
The next few lines start up the engine. Just like in most other + tutorials before. But in addition, we ask the user if he wants this + example to use high level shaders if he selected a driver which is + capable of doing so. +
Now for the more interesting parts. If we are using Direct3D, we
+ want to load vertex and pixel shader programs, if we have
In addition, we check if the hardware and the selected renderer
+ is capable of executing the shaders we want. If not, we simply set
+ the filename string to 0. This is not necessary, but useful in this
+ example: For example, if the hardware is able to execute vertex shaders
+ but not pixel shaders, we create a new material which only uses the
+ vertex shader, and no pixel shader. Otherwise, if we would tell the
+ engine to create this material and the engine sees that the hardware
+ wouldn't be able to fullfill the request completely,
Now lets create the new materials.
Now its time for testing out the materials. We create a test cube + and set the material we created. In addition, we add a text scene node + to the cube and a rotatation animator, to make it look more interesting + and important. +
Same for the second cube, but with the second material we created. +
+ Then we add a third cube without a shader on it, to be able to compare + the cubes. + +
+ And last, we add a skybox and a user controlled camera to the scene. For + the skybox textures, we disable mipmap generation, because we don't need + mipmaps on it. + +
+ Now draw everything. That's all. + +
+ Compile and run this, and I hope you have fun with your new little shader + writing tool :). + |
+
Shader files | +||||||||||||||
+
+
+ The files containing the shaders can be found in the media directory + of the SDK. However, they look like this: +
+
+
+
+
+
+
+ |
+
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/11.PerPixelLighting/Makefile b/src/others/irrlicht-1.8.1/examples/11.PerPixelLighting/Makefile new file mode 100644 index 0000000..affdc02 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/11.PerPixelLighting/Makefile @@ -0,0 +1,38 @@ +# 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 = 11.PerPixelLighting +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 -lopengl32 -lm +all_win32 clean_win32: SYSTEM=Win32-gcc +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: + $(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 diff --git a/src/others/irrlicht-1.8.1/examples/11.PerPixelLighting/PerPixelLighting.cbp b/src/others/irrlicht-1.8.1/examples/11.PerPixelLighting/PerPixelLighting.cbp new file mode 100644 index 0000000..2cb49da --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/11.PerPixelLighting/PerPixelLighting.cbp @@ -0,0 +1,56 @@ + +
Lets start! | +|||||||||||||
+
+
+
+ At first, we need to include all headers and do the stuff we always + do, like in nearly all other tutorials. +
For this example, we need an event receiver, to make it possible + for the user to switch between the three available material types. + In addition, the event receiver will create some small GUI window + which displays what material is currently being used. There is nothing + special done in this class, so maybe you want to skip reading it. +
We need to add a warning if the materials will not be able to be
+ displayed 100% correctly. This is no problem, they will be renderered
+ using fall back materials, but at least the user should know that
+ it would look better on better hardware. We simply check if the material
+ renderer is able to draw at full quality on the current hardware.
+ The IMaterialRenderer::getRenderCapability() returns 0 if this is
+ the case.
+ Before we start with the interesting stuff, we do some simple things: + Store pointers to the most important parts of the engine (video driver, + scene manager, gui environment) to safe us from typing too much, add + an irrlicht engine logo to the window and a user controlled first person + shooter style camera. Also, we let the engine now that it should store + all textures in 32 bit. This necessary because for parallax mapping, + we need 32 bit textures. + +
+ Because we want the whole scene to look a little bit scarier, we add + some fog to it. This is done by a call to IVideoDriver::setFog(). There + you can set + various fog settings. In this example, we use pixel fog, because it + will work well with the materials we'll use in this example. Please + note that you will have to set the material flag EMF_FOG_ENABLE to 'true' + in every scene node which should be affected by this fog. + +
+ To be able to display something interesting, we load a mesh from a .3ds + file which is a room I modeled with anim8or. It is the same room as + + from the specialFX example. Maybe you remember from that tutorial, I + am no good modeler at all and so I totally messed up the texture mapping + in this model, but we can simply repair it with the IMeshManipulator::makePlanarTextureMapping() + method. + +
+ Now for the first exciting thing: If we successfully loaded the mesh + we need to apply textures to it. Because we want this room to be displayed + with a very cool material, we have to do a little bit more than just + set the textures. Instead of only loading a color map as usual, we also + load a height map which is simply a grayscale texture. From this height + map, we create a normal map which we will set as second texture of the + room. If you already have a normal map, you could directly set it, but + I simply didn´t find a nice normal map for this texture. The normal + map texture is being generated by the makeNormalMapTexture method + of the VideoDriver. The second parameter specifies the height of the + heightmap. If you set it to a bigger value, the map will look more rocky. + +
+ But just setting color and normal map is not everything. The material + we want to use needs some additional informations per vertex like tangents + and binormals. + Because we are too lazy to calculate that information now, we let Irrlicht + do this for us. That's why we call IMeshManipulator::createMeshWithTangents(). + It + creates a mesh copy with tangents and binormals from any other mesh. + After we've done that, we simply create a standard mesh scene node with + this + mesh copy, set color and normal map and adjust some other material settings. + Note that we set EMF_FOG_ENABLE to true to enable fog in the room. + +
+ After we've created a room shaded by per pixel lighting, we add a sphere + into it with the same material, but we'll make it transparent. In addition, + because the sphere looks somehow like a familiar planet, we make it + rotate. The procedure is similar as before. The difference is that we + are loading + the mesh from an .x file which already contains a color map so we do + not need to load it manually. But the sphere is a little bit too small + for our needs, so we scale it by the factor 50. + +
+ Per pixel lighted materials only look cool when there are moving lights. + So we add some. And because moving lights alone are so boring, we add + billboards + to them, and a whole particle system to one of them. We start with the + first light which is red and has only the billboard attached. + +
+ Now the same again, with the second light. The difference is that we + add a particle system to it too. And because the light moves, the particles + of the particlesystem will follow. If you want to know more about how + particle systems are created in Irrlicht, take a look at the specialFx + example. + Maybe you will have noticed that we only add 2 lights, this has a simple + reason: The low end version of this material was written in ps1.1 and + vs1.1, which doesn't allow more lights. You could add a third light + to the scene, but it won't be used to shade the walls. But of course, + this will change in future versions of Irrlicht were higher versions + of pixel/vertex shaders will be implemented too. + +
+ Finally, draw everything. That's it. + +
+ |
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/12.TerrainRendering/Makefile b/src/others/irrlicht-1.8.1/examples/12.TerrainRendering/Makefile new file mode 100644 index 0000000..92b529f --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/12.TerrainRendering/Makefile @@ -0,0 +1,38 @@ +# 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 = 12.TerrainRendering +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 -lopengl32 -lm +all_win32 clean_win32: SYSTEM=Win32-gcc +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: + $(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 diff --git a/src/others/irrlicht-1.8.1/examples/12.TerrainRendering/TerrainRendering.cbp b/src/others/irrlicht-1.8.1/examples/12.TerrainRendering/TerrainRendering.cbp new file mode 100644 index 0000000..a0c93b7 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/12.TerrainRendering/TerrainRendering.cbp @@ -0,0 +1,56 @@ + +
Lets start! | +|||||||
+
+
+
+ In the beginning there is nothing special. We include the needed + header files and create an event listener to listen if the user presses + the 'W' key so we can switch to wireframe mode and if he presses 'D' + we toggle to material between solid and detail mapped. +
The start of the main function starts like in most other example. + We ask the user for the desired renderer and start it up. +
First, we add standard stuff to the scene: A nice irrlicht engine + logo, a small help text, a user controlled camera, and we disable + the mouse cursor. +
Here comes the terrain renderer scene node: We add it just like
+ any other scene node to the scene using ISceneManager::addTerrainSceneNode().
+ The only parameter we use is a file name to the heightmap we use.
+ A heightmap is simply a gray scale texture. The terrain renderer loads
+ it and creates the 3D terrain from it.
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. +
To make the user be able to switch between normal and wireframe mode, + we create an instance of the event reciever from above and let Irrlicht + know about it. In addition, we add the skybox which we already used + in lots of Irrlicht examples. +
That's it, draw everything. Now you know how to use terrain in Irrlicht. +
+ |
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/13.RenderToTexture/Makefile b/src/others/irrlicht-1.8.1/examples/13.RenderToTexture/Makefile new file mode 100644 index 0000000..7888648 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/13.RenderToTexture/Makefile @@ -0,0 +1,38 @@ +# 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 = 13.RenderToTexture +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 -lopengl32 -lm +all_win32 clean_win32: SYSTEM=Win32-gcc +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: + $(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 diff --git a/src/others/irrlicht-1.8.1/examples/13.RenderToTexture/RenderToTexture.cbp b/src/others/irrlicht-1.8.1/examples/13.RenderToTexture/RenderToTexture.cbp new file mode 100644 index 0000000..db3911e --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/13.RenderToTexture/RenderToTexture.cbp @@ -0,0 +1,55 @@ + +
Lets start! | +||||||
+
+
+
+ In the beginning, everything as usual. Include the needed headers, + ask the user for the rendering driver, create the Irrlicht Device: +
Now, we load an animated mesh to be displayed. As in most examples,
+ we'll take the fairy md2 model. The difference here: We set the shininess
To make specular highlights appear on the model, we need a dynamic + light in the scene. We add one directly in vicinity of the model. + In addition, to make the model not that dark, we set the ambient light + to gray. +
The next is just some standard stuff: Add a user controlled camera + to the scene, disable mouse cursor, and add a test cube and let it + rotate to make the scene more interesting. +
To test out the render to texture feature, we need a render target + texture. These are not like standard textures, but need to be created + first. To create one, we call IVideoDriver::createRenderTargetTexture() + and specify the size of the texture. Please don't use sizes bigger + than the frame buffer for this, because the render target shares the + zbuffer with the frame buffer. And because we want to render the scene + not from the user camera into the texture, we add another, fixed camera + to the scene. But before we do all this, we check if the current running + driver is able to render to textures. If it is not, we simply display + a warning text. +
Nearly finished. Now we need to draw everything. Every frame, we
+ draw the scene twice. Once from the fixed camera into the render target
+ texture and once as usual. When rendering into the render target,
+ we need to disable the visibilty of the test cube, because it has
+ the render target texture applied to it.
|
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/14.Win32Window/Makefile b/src/others/irrlicht-1.8.1/examples/14.Win32Window/Makefile new file mode 100644 index 0000000..e76f2ff --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/14.Win32Window/Makefile @@ -0,0 +1,38 @@ +# 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 = 14.Win32Window +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 -lopengl32 -lm +all_win32 clean_win32: SYSTEM=Win32-gcc +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: + $(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 diff --git a/src/others/irrlicht-1.8.1/examples/14.Win32Window/Win32Window.cbp b/src/others/irrlicht-1.8.1/examples/14.Win32Window/Win32Window.cbp new file mode 100644 index 0000000..06f310b --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/14.Win32Window/Win32Window.cbp @@ -0,0 +1,43 @@ + +
Lets start! | +|||
+
+
+
+ In the begining, we create a windows window using the windows API. + I'm not going to explain this code, because it is windows specific. + See the MSDN or a windows book for details. +
So now that we have some window, we can create an Irrlicht device + inside of it. We use Irrlicht createEx() function for this. We only + need the handle (HWND) to that window, set it as windowsID parameter + and start up the engine as usual. That's it. +
Now the only thing missing is the drawing loop using IrrlichtDevice::run().
+ We do this as usual. But instead of this, there is another possibility:
+ You can also simply use your own message loop using GetMessage, DispatchMessage
+ and whatever. Calling
That's it, Irrlicht now runs in your own windows window. + |
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/15.LoadIrrFile/LoadIrrFile.cbp b/src/others/irrlicht-1.8.1/examples/15.LoadIrrFile/LoadIrrFile.cbp new file mode 100644 index 0000000..edb64dc --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/15.LoadIrrFile/LoadIrrFile.cbp @@ -0,0 +1,54 @@ + +
+ |
+ Tutorial 15. Load .irr File |
+
+ Since version 1.1, Irrlicht is able to save and load the full scene + graph into an .irr file, an xml based format. There is also an editor + available to edit those files, named irrEdit on http://www.ambiera.com/irredit, + which can also be used as world and particle editor. This tutorial shows + how to use .irr files. +
|
+
+ Lets start! |
+ |||
+
+ Lets start: Create an Irrlicht device and setup the window. +
Now load our .irr file. .irr files can store the whole scene graph + including animators, materials and particle systems. And there is also + the possibility to store arbitrary user data for every scene node in + that file. To keep this example simple, we are simply loading the scene + here. See the documentation at ISceneManager::loadScene and ISceneManager::saveScene + for more information. So to load and display a complicated huge scene, + we only need a single call to loadScene(). +
That was it already. Now add a camera and draw the scene. +
+ |
+
+
+ + diff --git a/src/others/irrlicht-1.8.1/examples/16.Quake3MapShader/Makefile b/src/others/irrlicht-1.8.1/examples/16.Quake3MapShader/Makefile new file mode 100644 index 0000000..952b309 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/16.Quake3MapShader/Makefile @@ -0,0 +1,38 @@ +# 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 = 16.Quake3MapShader +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 -lopengl32 -lm +all_win32 clean_win32: SYSTEM=Win32-gcc +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: + $(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 diff --git a/src/others/irrlicht-1.8.1/examples/16.Quake3MapShader/Quake3MapShader.cbp b/src/others/irrlicht-1.8.1/examples/16.Quake3MapShader/Quake3MapShader.cbp new file mode 100644 index 0000000..6fc6bb3 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/16.Quake3MapShader/Quake3MapShader.cbp @@ -0,0 +1,56 @@ + +