This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:orx:tutorials:lighting [2011/03/10 17:08 (13 years ago)] – Added config iarwain | en:tutorials:shaders:lighting [2020/08/31 08:56 (4 years ago)] (current) – ↷ Links adapted because of a move operation iarwain | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Summary ===== | ===== Summary ===== | ||
- | This is our third stand alone tutorial, written in plain '' | + | This is tutorial |
- | //NB: If you want to see how to use orx while using '' | + | //NB: If you want to see how to use orx while using '' |
As we are **NOT** using the default executable anymore for this tutorial, the tutorial code will be directly built into the executable and not into an external library. | As we are **NOT** using the default executable anymore for this tutorial, the tutorial code will be directly built into the executable and not into an external library. | ||
- | See previous | + | See previous basic tutorials for more info about basic [[..:objects:object|object creation]], [[..:clocks:clock|clock handling]], [[..:objects:frame|frames hierarchy]], |
This tutorial shows how to generate normal maps and use shaders for pixel-based lighting effects.\\ | This tutorial shows how to generate normal maps and use shaders for pixel-based lighting effects.\\ | ||
Line 46: | Line 46: | ||
orxEvent_AddHandler(orxEVENT_TYPE_SHADER, | orxEvent_AddHandler(orxEVENT_TYPE_SHADER, | ||
- | orxEvent_AddHandler(orxEVENT_TYPE_OBJECT, EventHandler); | + | orxEvent_AddHandler(orxEVENT_TYPE_TEXTURE, EventHandler); |
pstTextureTable = orxHashTable_Create(16, | pstTextureTable = orxHashTable_Create(16, | ||
Line 117: | Line 117: | ||
<code c> | <code c> | ||
- | else if((_pstEvent-> | + | else if((_pstEvent-> |
{ | { | ||
- | | + | |
- | pstGraphic = orxOBJECT_GET_STRUCTURE(orxOBJECT(_pstEvent-> | + | |
- | if(pstGraphic) | + | |
- | { | + | |
- | CreateNormalMap(orxTEXTURE(orxGraphic_GetData(pstGraphic))); | + | |
- | } | + | |
} | } | ||
Line 130: | Line 125: | ||
}</ | }</ | ||
- | When a '' | + | When a '' |
- | This means that a normal map for a given texture is created the first time an object using that texture is created by calling '' | + | This means that a normal map for a given texture is created by calling '' |
Let's have a look to that function more closely. | Let's have a look to that function more closely. | ||
Line 364: | Line 359: | ||
===== Resources ===== | ===== Resources ===== | ||
- | Source code: [[https://orx.svn.sourceforge.net/svnroot/orx/trunk/ | + | Source code: [[https://github.com/orx/orx/blob/master/ |
- | + | ||
- | Config file: [[https:// | + | |
+ | Config file: [[https:// |