Jo Engine glows: the halo of light around a lamp (a soft disc of its color, without edge, and a few thin rays of light, added to the image).
More...
Go to the source code of this file.
|
| int | jo_3d_glow_add (const jo_pos3D_fixed *const position, const unsigned char r, const unsigned char g, const unsigned char b, const int radius, const int intensity) |
| | Add a glow.
|
| void | jo_3d_glow_set_intensity (const int id, const int intensity) |
| | Change the intensity of a glow (a lamp that flickers, an alarm).
|
| void | jo_3d_glow_set_position (const int id, const jo_pos3D_fixed *const position) |
| | Move a glow.
|
| void | jo_3d_glow_set_color (const int id, const unsigned char r, const unsigned char g, const unsigned char b) |
| | Change the color of a glow.
|
| void | jo_3d_glows_clear (void) |
| | Remove all the glows.
|
| void | jo_3d_glows_set_rays (const int light, const int diagonal_light) |
| | The light of the rays of the glows (the star around the disc), before jo_3d_glows_enable() (its characters are built then).
|
| bool | jo_3d_glows_enable (const bool enabled) |
| | Turn the glows on or off: the VDP2 layers (see the remarks of this file: the 3D planes are hidden while they are on).
|
| void | jo_3d_glows_set_occlusion (bool(*hit)(const jo_pos3D_fixed *const origin, const jo_pos3D_fixed *const dir, const jo_fixed max_t)) |
| | The walls hide the glows behind them (a ray from the camera to the lamp, a few each frame).
|
| void | jo_3d_glows_set_clip (bool(*clip)(const jo_pos3D_fixed *const position, jo_3d_rect *const rect)) |
| | The glows are seen only in a rectangle of the screen: the rectangle where the place of the lamp is seen (a lamp in a room seen through a door: its glow stays in the door, see jo_cells_view_rect_at()). A window of the VDP2 cuts the disc to the rectangle.
|
| void | jo_3d_glows_draw (const jo_pos3D_fixed *const camera) |
| | Place the glows seen from the camera (once per frame, after the camera: its matrix is the current matrix).
|
Jo Engine glows: the halo of light around a lamp (a soft disc of its color, without edge, and a few thin rays of light, added to the image).
- Author
- Johannes Fetz
- The VDP1 blends at 50 % only: a half transparent sprite shows its edge (and darkens the dark walls around it). The glows are drawn by the VDP2 instead: NBG2 and NBG3 over the sprite layer, with the color calculation "add": the color of a glow is added to the 3D view (0 at its edge: no edge, like the light of a real lamp in a camera)
- 2 glows on the screen at the same time (the 2 brightest seen; a glow fades in and out). Each layer shows one disc (16 to 128 pixels, 15 levels of light), moved by its scroll and colored by its palette: no CPU time per pixel
- The layers change when the image of the frame is displayed (not when the frame is computed): the glow stays on its lamp when the camera turns
- They use the VRAM bank B0 of the VDP2: the rotation screen (the 3D planes, see background.h) is hidden while the glows are on (for the places where the 3D planes are not seen: inside a building, underground...)
- A wall between the camera and a lamp hides its glow (see jo_3d_glows_set_occlusion())
Usage: jo_3d_glows_enable(true), jo_3d_glow_add() for each lamp, then jo_3d_glows_draw() at each frame after the camera (its matrix is the current matrix)
- Bug
- No known bugs.
◆ JO_3D_GLOW_MAX
◆ jo_3d_glow_add()
| int jo_3d_glow_add |
( |
const jo_pos3D_fixed *const | position, |
|
|
const unsigned char | r, |
|
|
const unsigned char | g, |
|
|
const unsigned char | b, |
|
|
const int | radius, |
|
|
const int | intensity ) |
Add a glow.
- Parameters
-
| position | Position (world) |
| r | Red (0 to 255): the color added at its middle with the intensity 256 |
| g | Green |
| b | Blue |
| radius | Radius (world units): its size on the screen changes with its distance (16 to 128 pixels) |
| intensity | Intensity (0: off, 256: its color) |
- Returns
- Id of the glow, -1 if there are too many
◆ jo_3d_glow_set_color()
| void jo_3d_glow_set_color |
( |
const int | id, |
|
|
const unsigned char | r, |
|
|
const unsigned char | g, |
|
|
const unsigned char | b ) |
Change the color of a glow.
- Parameters
-
| id | Id of the glow |
| r | Red (0 to 255) |
| g | Green |
| b | Blue |
◆ jo_3d_glow_set_intensity()
| void jo_3d_glow_set_intensity |
( |
const int | id, |
|
|
const int | intensity ) |
Change the intensity of a glow (a lamp that flickers, an alarm).
- Parameters
-
| id | Id of the glow |
| intensity | Intensity (0: off, 256: its color) |
◆ jo_3d_glow_set_position()
| void jo_3d_glow_set_position |
( |
const int | id, |
|
|
const jo_pos3D_fixed *const | position ) |
Move a glow.
- Parameters
-
| id | Id of the glow |
| position | Position (world) |
◆ jo_3d_glows_clear()
| void jo_3d_glows_clear |
( |
void | | ) |
|
◆ jo_3d_glows_draw()
Place the glows seen from the camera (once per frame, after the camera: its matrix is the current matrix).
- Parameters
-
| camera | Position of the camera (world): the rays of the occlusion |
◆ jo_3d_glows_enable()
| bool jo_3d_glows_enable |
( |
const bool | enabled | ) |
|
Turn the glows on or off: the VDP2 layers (see the remarks of this file: the 3D planes are hidden while they are on).
- Parameters
-
| enabled | true: the glows are displayed (the first call builds their characters in the VRAM) |
- Returns
- false if the VDP2 memory is full (the glows stay off)
◆ jo_3d_glows_set_clip()
The glows are seen only in a rectangle of the screen: the rectangle where the place of the lamp is seen (a lamp in a room seen through a door: its glow stays in the door, see jo_cells_view_rect_at()). A window of the VDP2 cuts the disc to the rectangle.
- Parameters
-
| clip | Gives the rectangle where a point is seen, false if it is not seen; JO_NULL: the whole screen |
◆ jo_3d_glows_set_occlusion()
The walls hide the glows behind them (a ray from the camera to the lamp, a few each frame).
- Parameters
-
| hit | The ray from origin along dir (unit vector) hits something before max_t (Q16.16), JO_NULL: always seen |
◆ jo_3d_glows_set_rays()
| void jo_3d_glows_set_rays |
( |
const int | light, |
|
|
const int | diagonal_light ) |
The light of the rays of the glows (the star around the disc), before jo_3d_glows_enable() (its characters are built then).
- Parameters
-
| light | Light of the 4 rays on the axes (0 to 256, in the middle of the glow; 150 by default, 0: no rays) |
| diagonal_light | Light of the 4 shorter rays on the diagonals (100 by default) |