From 959831f4ef5a3e797f576c3de08cd65032c997ad Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 13 Jan 2013 18:54:10 +1000 Subject: Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard. --- .../examples/11.PerPixelLighting/tutorial.html | 1004 ++++++++++---------- 1 file changed, 502 insertions(+), 502 deletions(-) (limited to 'libraries/irrlicht-1.8/examples/11.PerPixelLighting/tutorial.html') diff --git a/libraries/irrlicht-1.8/examples/11.PerPixelLighting/tutorial.html b/libraries/irrlicht-1.8/examples/11.PerPixelLighting/tutorial.html index 89e87bd..986d176 100644 --- a/libraries/irrlicht-1.8/examples/11.PerPixelLighting/tutorial.html +++ b/libraries/irrlicht-1.8/examples/11.PerPixelLighting/tutorial.html @@ -1,502 +1,502 @@ - -
-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. - -
- |
-
- - + + +
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. + +
+ |
+
+ + -- cgit v1.1