40# define __JO_WATER_H__
42#if defined(JO_COMPILE_WITH_3D_SUPPORT) && defined(JO_COMPILE_WITH_DUAL_CPU_SUPPORT)
70# define JO_WATER_MAX_WAVES (8)
72# define JO_WATER_MAX_LEVELS (6)
74# define JO_WATER_MAX_CELLS (24)
207 const signed char shallow_g,
const signed char shallow_b,
const signed char deep_r,
208 const signed char deep_g,
const signed char deep_b,
const int sky,
209 const int slope_light_min,
const int slope_light_max,
const int glint)
211 config->
color = color;
215 config->
deep.
r = deep_r;
216 config->
deep.
g = deep_g;
217 config->
deep.
b = deep_b;
221 config->
glint = glint;
234 __water_set_look(config,
JO_COLOR_RGB(96, 196, 176), 4, 12, 10, 0, 4, 8, 4, -11, 6, 40);
237 __water_set_look(config,
JO_COLOR_RGB(40, 168, 168), 6, 16, 16, 0, 4, 12, 5, -12, 7, 44);
240 __water_set_look(config,
JO_COLOR_RGB(32, 148, 192), 6, 16, 18, 0, 2, 12, 5, -12, 7, 44);
243 __water_set_look(config,
JO_COLOR_RGB(24, 108, 200), 6, 14, 18, 0, 0, 10, 6, -12, 8, 48);
246 __water_set_look(config,
JO_COLOR_RGB(32, 72, 200), 8, 12, 20, 0, 0, 8, 7, -12, 8, 48);
249 __water_set_look(config,
JO_COLOR_RGB(24, 88, 168), 6, 18, 22, 0, 2, 10, 6, -14, 10, 60);
252 __water_set_look(config,
JO_COLOR_RGB(40, 176, 200), 4, 14, 14, 0, 0, 8, 4, -15, 8, 50);
255 __water_set_look(config,
JO_COLOR_RGB(88, 184, 216), 4, 12, 12, 0, 2, 6, 6, -12, 6, 40);
258 __water_set_look(config,
JO_COLOR_RGB(16, 64, 128), 8, 18, 24, 2, 4, 14, 7, -10, 10, 56);
261 __water_set_look(config,
JO_COLOR_RGB(40, 172, 184), 5, 16, 15, 1, 6, 10, 6, -9, 7, 36);
264 __water_set_look(config,
JO_COLOR_RGB(64, 136, 168), 6, 19, 22, 6, 8, 18, 6, -7, 5, 40);
583# define JO_WATER_MAX_OBJECTS (48)
585# define JO_WATER_MAX_ABOVE (24)
654# define JO_WATER_DIP_LEVELS (4)
668 const jo_fixed *
const depths,
const int palette_offset);
Mesh structure.
Definition 3d.h:248
#define JO_COLOR_RGB(R, G, B)
Get jo_color type from RGB additive color model.
Definition colors.h:106
jo_3d_mesh * mesh
Definition entity.h:11
int radius
Definition entity.h:3
int height
Definition entity.h:4
3D model loaded from a JOM file
Definition model.h:242
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition types.h:39
short jo_angle
Angle.
Definition types.h:65
unsigned short jo_color
15 bits color type
Definition types.h:53
int jo_fixed
Fixed point Q16.16 number.
Definition types.h:59
@ JO_SPRITE_SCREEN
Definition types.h:348
@ JO_VDP2_BLEND_RATIO
A part of the color of the screen and a part of the image under it (transparency).
Definition vdp2.h:726
void jo_vdp2_enable_blend(const jo_scroll_screen screens, unsigned char ratio)
Mix screens with the image under them.
void jo_vdp2_blend_rgb_sprites_only(const bool rgb_only)
Mix only the RGB pixels of the sprites (jo_vdp2_enable_blend(JO_SPRITE_SCREEN, ratio)): the palette p...
void jo_vdp2_set_blend_mode(const jo_vdp2_blend_mode mode)
Set how the screens are mixed (jo_vdp2_enable_blend()): the same for all the screens.
void jo_water_wave_front(jo_water *const w, const int x, const int z, const jo_angle direction, const int height, const int width)
A straight wave (2 crests, the second one the highest) that goes from a point in a direction: it grow...
int splash_life
Definition water.h:153
int direction
Definition water.h:80
int x
Definition water.h:442
void jo_water_float(jo_water *const w, jo_water_floating *const f)
Move a floating object (once per frame, after jo_water_update()): it falls (gravity),...
void jo_water_default_config(jo_water_config *const config)
A configuration that works: 4 levels (quads of 8, 16, 32, 64 units), the swell JO_WATER_SWELL_CHOPPY,...
int level_count
Definition water.h:106
void jo_water_set_waves(jo_water *const w, const jo_water_wave *const waves, const int count)
Change the swell (a calm sea, a storm, the wind turns).
int splash_speed
Definition water.h:152
void jo_water_update(jo_water *const w, const int frame, const int x, const int y, const int z, const jo_angle heading)
Move the waves to the time of the frame and the grid around the camera, compute the heights and the l...
int jo_water_add_model(jo_water *const w, jo_3d_model *const model, const int amount, const int far, jo_water_object **const objects)
Put a model under the water: an object per group of the model (OBJ o or g: a rock,...
int jo_water_foam_at(const jo_water *const w, const int x, const int z)
Foam at a point (0 to 255, see jo_water_foam()).
void jo_water_draw(jo_water *const w)
Draw the water (after jo_3d_camera_look_at()).
int surf
Definition water.h:134
int min_cells_per_wave
Definition water.h:109
static __jo_force_inline int jo_water_swell(jo_water_wave *const waves, const jo_water_swell_kind swell)
A standard swell (its directions not along the grid of the water).
Definition water.h:335
jo_fixed slope_x
Definition water.h:163
jo_water_look_kind
The standard looks of the water (its color and the light of its waves, see jo_water_config_look()).
Definition water.h:190
@ JO_WATER_LOOK_BRIGHT_TURQUOISE
Definition water.h:198
@ JO_WATER_LOOK_TROPICAL_TEAL
Definition water.h:193
@ JO_WATER_LOOK_DEFAULT
Definition water.h:191
@ JO_WATER_LOOK_FRENCH_BLUE
Definition water.h:196
@ JO_WATER_LOOK_DEEP_CONTRAST
Definition water.h:197
@ JO_WATER_LOOK_SUNNY_BEACH
Definition water.h:201
@ JO_WATER_LOOK_OCEAN_BLUE
Definition water.h:195
@ JO_WATER_LOOK_DEEP_PACIFIC
Definition water.h:200
@ JO_WATER_LOOK_MINT_LAGOON
Definition water.h:192
@ JO_WATER_LOOK_COUNT
Definition water.h:202
@ JO_WATER_LOOK_MERMAID_BLUE
Definition water.h:194
@ JO_WATER_LOOK_CARIBBEAN
Definition water.h:199
int update_cell
Definition water.h:108
static __jo_force_inline void __water_set_look(jo_water_config *const config, const jo_color color, const signed char shallow_r, const signed char shallow_g, const signed char shallow_b, const signed char deep_r, const signed char deep_g, const signed char deep_b, const int sky, const int slope_light_min, const int slope_light_max, const int glint)
Set the values of a look (see jo_water_config_look()).
Definition water.h:206
int cell
Definition water.h:88
signed char g
Definition water.h:97
int spot_distance
Definition water.h:126
int front_length
Definition water.h:154
bool textured
Definition water.h:143
int front_speed
Definition water.h:155
int ahead
Definition water.h:107
int bottom_depth
Definition water.h:138
int sky
Definition water.h:121
void jo_water_set_depth_map(jo_water *const w, const unsigned char *const map, const int size, const int shift, const int x, const int z)
The depth of the water around (a map of bytes: 0 the shore, 255 deep): the shallow water is lighter (...
void jo_water_add_above(jo_water *const w, const int x, const int y, const int z, const int radius, const int key_offset)
An object above the water in front of which the objects under the water stay (a jet ski,...
void jo_water_reshape(jo_water_object *const o)
The points of the mesh of an object changed: its size and its depth again (after jo_water_show(): onl...
jo_water_swell_kind
The standard swells (see jo_water_swell()): waves of 130 to 700 units, for quads of 16 to 64 units ne...
Definition water.h:313
@ JO_WATER_SWELL_STORM
Definition water.h:316
@ JO_WATER_SWELL_COUNT
Definition water.h:317
@ JO_WATER_SWELL_CHOPPY
Definition water.h:315
@ JO_WATER_SWELL_GENTLE
Definition water.h:314
static __jo_force_inline void jo_water_blend_with_bottom(const int blend)
The water seen through: the VDP2 mixes the RGB pixels of the sprites (the water, the objects under it...
Definition water.h:303
jo_fixed height
Definition water.h:81
struct s_jo_water_object jo_water_object
An object under the water (see jo_water_add_model()).
Definition water.h:580
int slope_light_min
Definition water.h:122
signed char b
Definition water.h:98
int caustics
Definition water.h:127
struct s_jo_water_dip jo_water_dip
An object on the water whose polygons under the surface are seen through the water (the hull of a boa...
Definition water.h:651
bool in_water
Definition water.h:450
void jo_water_set_far(jo_water_object *const o, const int far)
Change the distance where an object is not drawn any more (units: |dx| + |dz|).
int z
Definition water.h:443
int reflection
Definition water.h:128
int shallow_depth
Definition water.h:133
int period
Definition water.h:82
int half
Definition water.h:446
jo_water_steps shallow
Definition water.h:119
const jo_water_level * levels
Definition water.h:105
static __jo_force_inline int jo_water_look_blend(const jo_water_look_kind look)
The mix of the water with the bottom of the sea that goes with a standard look (see jo_water_blend_wi...
Definition water.h:273
jo_color foam_color
Definition water.h:130
void jo_water_set_textured(jo_water *const w, const bool textured)
The foam texture or not (see jo_water_config.textured).
jo_fixed jo_water_height(const jo_water *const w, const int x, const int z)
Height of the surface at a point (the waves, the splashes, the wave fronts at the time of jo_water_up...
int side
Definition water.h:89
jo_fixed vy
Definition water.h:445
int glint
Definition water.h:124
const jo_water_config * jo_water_get_config(const jo_water *const w)
The configuration of the water (read only: the look can be changed with jo_water_set_look()).
int sink
Definition water.h:447
jo_water_object * jo_water_add_mesh(jo_water *const w, jo_3d_mesh *const mesh, const int first, const int count, const int amount, const int far)
Put polygons of a mesh under the water (see jo_water_add_model()): a mesh made by the program,...
void jo_water_set_sun(jo_water *const w, const jo_angle azimuth, const jo_angle elevation)
Position of the sun (the light, the glints, the spot).
jo_color jo_water_seen_color(const jo_water *const w, const jo_color object, const int amount)
The color of the water seen from above (its color with the light of config.shallow: the face of a wav...
int skirt
Definition water.h:111
void jo_water_drop(jo_water *const w, const int x, const int z, const int height)
An object falls in the water: a ring of waves goes away from the point (near the camera only).
jo_angle tilt_z
Definition water.h:449
jo_fixed jo_water_drawn_height(const jo_water *const w, const int x, const int z)
Height of the surface as it is drawn at a point (the vertices of the finest level that covers it,...
void jo_water_floating_init(jo_water_floating *const f, const int x, const int z, const int height, const int half, const int sink)
Start an object above the water (it falls, see jo_water_float()).
void jo_water_set_swell(jo_water *const w, const jo_fixed scale)
Strength of the swell: the heights of the waves x scale (a storm that grows, a calm that comes).
jo_water_dip * jo_water_add_dip(jo_water *const w, jo_3d_mesh *const mesh, const int levels, const short *const amounts, const jo_fixed *const depths, const int palette_offset)
Prepare a floating object: its polygons under the surface take their colors seen through the water,...
bool grain
Definition water.h:145
void jo_water_sample(const jo_water *const w, const int x, const int z, jo_water_point *const point)
Height and slopes of the surface at a point: for an object on the water (its height,...
void jo_water_place(jo_water_object *const o, const int x, const int y, const int z, const jo_angle heading)
Place the space of an object (the space of the points of its mesh): the world by default.
static __jo_force_inline void jo_water_config_look(jo_water_config *const config, const jo_water_look_kind look)
Set a standard look in a configuration: color, shallow, deep, sky, slope_light_min,...
Definition water.h:229
void jo_water_draw_with(jo_water *const w, void(*objects)(void), void(*objects_on_slave)(void))
Draw the water and the objects on it: the master CPU draws some objects while the slave CPU draws the...
int slope_light_max
Definition water.h:123
int bottom
Definition water.h:135
jo_water_steps shore
Definition water.h:132
void jo_water_foam(jo_water *const w, const int x, const int z, const int radius, const int life)
Foam on the water (a trail, a wake, a splash): a disc of the foam grid (cells of 8 units around the c...
jo_angle tilt_x
Definition water.h:448
void jo_water_set_look(jo_water *const w, const jo_water_config *const look)
Change the look (the colors and the light: color, shallow, deep, sky, slope_light_min/max,...
int spot
Definition water.h:125
jo_fixed jo_water_wave_height(const jo_water *const w, const int x, const int z)
Height of the waves at a point, without the splashes and the wave fronts (faster than jo_water_height...
int length
Definition water.h:79
jo_water_steps deep
Definition water.h:120
jo_water * jo_water_create(const jo_water_config *const config)
Create the water: load the textures, create the grid.
int see_through
Definition water.h:139
int foam_white
Definition water.h:129
signed char r
Definition water.h:96
void jo_water_show(jo_water_object *const o, const bool shown, const unsigned int hidden)
Show or hide an object, hide some of its polygons.
int fade
Definition water.h:110
const char * patterns_file
Definition water.h:147
int front_life
Definition water.h:156
jo_fixed slope_z
Definition water.h:164
static __jo_force_inline void __water_set_wave(jo_water_wave *const wave, const int length, const int direction, const jo_fixed height, const int period)
Set a wave (see jo_water_swell()).
Definition water.h:321
int slave_levels
Definition water.h:112
jo_fixed height
Definition water.h:162
void jo_water_dip_mesh(jo_water_dip *const d, const jo_fixed surface, const jo_angle pitch, const jo_angle roll)
Set the colors of the polygons of a floating object from the depth of their middles under the surface...
int splash_length
Definition water.h:151
int jo_water_quad_side(const jo_water *const w, const int x, const int z)
Side of the quads of the water drawn at a point (the finest level that covers it, see jo_water_config...
struct s_jo_water jo_water
The water (see jo_water_create()).
Definition water.h:168
jo_fixed y
Definition water.h:444
int wave_count
Definition water.h:116
const jo_water_wave * waves
Definition water.h:115
jo_color color
Definition water.h:118
Configuration of the water (jo_water_default_config(), then change what you need).
Definition water.h:103
An object that falls in the water and floats on the waves (a crate, a barrel, a buoy): see jo_water_f...
Definition water.h:441
A level of the grid.
Definition water.h:87
Height and slopes of the surface at a point (see jo_water_sample()).
Definition water.h:161
Gouraud steps per channel (16: the color as it is).
Definition water.h:95
A wave of the swell (a sine along a direction).
Definition water.h:78