Jo Engine 2026.11.6
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
glow.h
Go to the documentation of this file.
1/*
2** Jo Sega Saturn Engine
3** Copyright (c) 2012-2026, Johannes Fetz (johannesfetz@gmail.com)
4** All rights reserved.
5**
6** Redistribution and use in source and binary forms, with or without
7** modification, are permitted provided that the following conditions are met:
8** * Redistributions of source code must retain the above copyright
9** notice, this list of conditions and the following disclaimer.
10** * Redistributions in binary form must reproduce the above copyright
11** notice, this list of conditions and the following disclaimer in the
12** documentation and/or other materials provided with the distribution.
13** * Neither the name of the Johannes Fetz nor the
14** names of its contributors may be used to endorse or promote products
15** derived from this software without specific prior written permission.
16**
17** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
52
53#ifndef __JO_GLOW_H__
54# define __JO_GLOW_H__
55
56#ifdef JO_COMPILE_WITH_3D_SUPPORT
57
59# define JO_3D_GLOW_MAX (48)
60
63typedef enum
64{
65 JO_3D_GLOW_STAR = 0, // A soft disc and 8 thin rays (see jo_3d_glows_set_rays()): the default
66 JO_3D_GLOW_DISC = 1, // A soft disc, no rays (a car light, a small lamp)
67 JO_3D_GLOW_RECT = 2, // A lit rectangle, its light falling around it (a sign, a window)
68 JO_3D_GLOW_FRAME = 3 // The outline of a rectangle, its light on both sides of the line (a neon tube)
70
73typedef enum
74{
75 JO_3D_GLOW_VDP2 = 0, // The cells of a VDP2 screen (NBG2): the default (see the remarks of this file)
76 JO_3D_GLOW_LAYER = 1 // Sprites of the VDP1 in the transparency layer (see jo/transparency.h)
78
88int jo_3d_glow_add(const jo_pos3D_fixed * const position, const unsigned char r, const unsigned char g,
89 const unsigned char b, const int radius, const int intensity);
90
100void jo_3d_glow_set_shape(const int id, const jo_3d_glow_shape shape, const int width, const int height);
101
108void jo_3d_glow_set_anchor(const int id, const bool anchor);
109
114void jo_3d_glow_set_radius(const int id, const int radius);
115
120void jo_3d_glow_set_intensity(const int id, const int intensity);
121
126void jo_3d_glow_set_position(const int id, const jo_pos3D_fixed * const position);
127
134void jo_3d_glow_set_color(const int id, const unsigned char r, const unsigned char g, const unsigned char b);
135
138
144void jo_3d_glows_set_rays(const int light, const int diagonal_light);
145
156
158# define JO_3D_GLOW_LAYER_SHOWN (24)
161# define JO_3D_GLOW_LAYER_RECTS (4)
162
167bool jo_3d_glows_enable(const bool enabled);
168
172void jo_3d_glows_set_occlusion(bool (*hit)(const jo_pos3D_fixed * const origin, const jo_pos3D_fixed * const dir,
173 const jo_fixed max_t));
174
180void jo_3d_glows_set_clip(bool (*clip)(const jo_pos3D_fixed * const position, jo_3d_rect * const rect));
181
186void jo_3d_glows_draw(const jo_pos3D_fixed * const camera);
187
188#endif /* !JO_COMPILE_WITH_3D_SUPPORT */
189
190#endif /* !__JO_GLOW_H__ */
191
192/*
193** END OF FILE
194*/
A rectangle of the screen (pixels, the edges are in it).
Definition 3d.h:1624
int radius
Definition entity.h:3
int height
Definition entity.h:4
jo_pos3D_fixed position
Definition entity.h:2
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_glows_set_mode(const jo_3d_glow_mode mode)
Where the glows are drawn, before jo_3d_glows_enable() (or the glows turned off and on again).
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_glow_set_shape(const int id, const jo_3d_glow_shape shape, const int width, const int height)
Change the shape of a glow.
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 chara...
void jo_3d_glows_clear(void)
Remove all the glows.
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 whi...
void jo_3d_glow_set_position(const int id, const jo_pos3D_fixed *const position)
Move a glow.
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.
jo_3d_glow_mode
Where the glows are drawn (see jo_3d_glows_set_mode()).
Definition glow.h:74
@ JO_3D_GLOW_LAYER
Definition glow.h:76
@ JO_3D_GLOW_VDP2
Definition glow.h:75
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 mat...
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 se...
jo_3d_glow_shape
Shapes of the glows (see jo_3d_glow_set_shape()).
Definition glow.h:64
@ JO_3D_GLOW_DISC
Definition glow.h:66
@ JO_3D_GLOW_STAR
Definition glow.h:65
@ JO_3D_GLOW_RECT
Definition glow.h:67
@ JO_3D_GLOW_FRAME
Definition glow.h:68
void jo_3d_glow_set_radius(const int id, const int radius)
Change the size of a glow.
void jo_3d_glow_set_anchor(const int id, const bool anchor)
Place a glow to the pixel: the scroll of the layer puts the grid of the cells on it (the glow seen th...
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.
int jo_fixed
Fixed point Q16.16 number.
Definition types.h:59
3D position using fixed numbers
Definition types.h:103