GuiLensFlareHud - Lens flares and white out for TGEA 1.8.1
by Jaimi McEntire · 05/14/2009 (12:20 pm) · 4 comments
This resource adds functionality for standard lens flares and screen whiteout. When the sun gets closer to the center of the screen, a whiteout effect is also applied. Lensflares or whiteout do not display when the camera is underwater.
To install, download the code file below, and add fxLensFlare.h, fxLensFlare.cpp, and GuiLensFlareHud.cpp to you your project (I put mine in engine/source/T3D/fx)
If you have modified FxSunlight, then you will need to use a program like WinMerge to add the needed changes to fxSunlight.cpp and fxSunlight.h to your version. If you have not made any changes to these, you can simply replace them with the files included in the zip.
Download code
Here is a picture of the lensflare:

You will need to have a lensflares.png placed in your game/common/lighting directory. This png file should contain 4 different lensflare styles.
Here is a sample Lensflares.png file:

Currently, the number, size and color of the lensflares are specified in the source. You can modify this as needed. Later versions of this will likely be more dynamic.
To use this, add a GuiLensFlareHud control to your PlayGui. Align it to the play area, and place it at the top of the stack (otherwise, lensflares can draw over gui elements).
GuiLensFlareHud has the following properties:
RenderFlares (bool): Whether or not to render lens flares. Default is true.
WhiteOut (bool): Whether or not to white out the screen. Default is true.
WhiteOutColor (ColorI): The color of the whiteout. Default is a partially transparent white.
WhiteOutFade (float): The time to fade the white out, in seconds. Default is 1 second.
To install, download the code file below, and add fxLensFlare.h, fxLensFlare.cpp, and GuiLensFlareHud.cpp to you your project (I put mine in engine/source/T3D/fx)
If you have modified FxSunlight, then you will need to use a program like WinMerge to add the needed changes to fxSunlight.cpp and fxSunlight.h to your version. If you have not made any changes to these, you can simply replace them with the files included in the zip.
Download code
Here is a picture of the lensflare:

You will need to have a lensflares.png placed in your game/common/lighting directory. This png file should contain 4 different lensflare styles.
Here is a sample Lensflares.png file:

Currently, the number, size and color of the lensflares are specified in the source. You can modify this as needed. Later versions of this will likely be more dynamic.
To use this, add a GuiLensFlareHud control to your PlayGui. Align it to the play area, and place it at the top of the stack (otherwise, lensflares can draw over gui elements).
GuiLensFlareHud has the following properties:
RenderFlares (bool): Whether or not to render lens flares. Default is true.
WhiteOut (bool): Whether or not to white out the screen. Default is true.
WhiteOutColor (ColorI): The color of the whiteout. Default is a partially transparent white.
WhiteOutFade (float): The time to fade the white out, in seconds. Default is 1 second.
About the author

Torque Owner Ronald J Nelson
Code Hammer Games