35#ifndef __JO_VDP1_COMMAND_PIPELINE_H__
36# define __JO_VDP1_COMMAND_PIPELINE_H__
56#ifndef JO_VDP1_MAX_COMMANDS
57# define JO_VDP1_MAX_COMMANDS (1000)
82# define JO_VDP1_CMD_NORMAL_SPRITE (0x0000)
83# define JO_VDP1_CMD_SCALED_SPRITE (0x0001)
84# define JO_VDP1_CMD_DISTORTED_SPRITE (0x0002)
85# define JO_VDP1_CMD_POLYGON (0x0004)
86# define JO_VDP1_CMD_POLYLINE (0x0005)
87# define JO_VDP1_CMD_LINE (0x0006)
88# define JO_VDP1_CMD_USER_CLIP (0x0008)
89# define JO_VDP1_CMD_SYSTEM_CLIP (0x0009)
90# define JO_VDP1_CMD_LOCAL_COORD (0x000A)
91# define JO_VDP1_CMD_SKIP_ASSIGN (0x5000)
92# define JO_VDP1_CMD_END (0x8000)
98# define JO_VDP1_FUNCTION_SPRITE (1)
100# define JO_VDP1_FUNCTION_TEXTURE (2)
102# define JO_VDP1_FUNCTION_POLYGON (4)
104# define JO_VDP1_FUNCTION_POLYLINE (5)
106# define JO_VDP1_FUNCTION_LINE (6)
108# define JO_VDP1_FUNCTION_USER_CLIP (8)
110# define JO_VDP1_FUNCTION_SYSTEM_CLIP (9)
112# define JO_VDP1_FUNCTION_LOCAL_COORDINATES (10)
115# define JO_VDP1_DIRECTION_FUNCTION_MASK (0x0f)
117# define JO_VDP1_DIRECTION_FLIP_MASK (0x30)
119# define JO_VDP1_H_FLIP (0x10)
125# define JO_VDP1_MSB_ON (1 << 15)
127# define JO_VDP1_HIGH_SPEED_SHRINK (1 << 12)
131# define JO_VDP1_PRE_CLIPPING_DISABLE (1 << 11)
133# define JO_VDP1_NO_WINDOW (0)
135# define JO_VDP1_WINDOW_IN (2 << 9)
137# define JO_VDP1_WINDOW_OUT (3 << 9)
139# define JO_VDP1_MESH (1 << 8)
141# define JO_VDP1_NO_MESH (0)
143# define JO_VDP1_END_CODE_DISABLE (1 << 7)
145# define JO_VDP1_RGB_END_CODE (0x7FFF)
147# define JO_VDP1_TRANSPARENT_PIXEL_DISABLE (1 << 6)
149# define JO_VDP1_COLOR_MODE_16_BANK (0 << 3)
151# define JO_VDP1_COLOR_MODE_16_LOOKUP (1 << 3)
153# define JO_VDP1_COLOR_MODE_64_BANK (2 << 3)
155# define JO_VDP1_COLOR_MODE_128_BANK (3 << 3)
157# define JO_VDP1_COLOR_MODE_256_BANK (4 << 3)
159# define JO_VDP1_COLOR_MODE_RGB (5 << 3)
161# define JO_VDP1_COLOR_MODE_MASK (7 << 3)
163# define JO_VDP1_COLOR_CALC_REPLACE (0)
165# define JO_VDP1_COLOR_CALC_SHADOW (1)
167# define JO_VDP1_COLOR_CALC_HALF_LUMINANCE (2)
169# define JO_VDP1_COLOR_CALC_HALF_TRANSPARENT (3)
171# define JO_VDP1_COLOR_CALC_GOURAUD (4)
173# define JO_VDP1_COLOR_CALC_MASK (7)
175# define JO_VDP1_NO_GOURAUD (0)
177# define JO_VDP1_NO_PALETTE (0)
183# define JO_VDP1_TEXTURE_SIZE_SHIFT_16_COLORS (3)
185# define JO_VDP1_TEXTURE_SIZE_SHIFT_256_COLORS (2)
187# define JO_VDP1_TEXTURE_SIZE_SHIFT_32K_COLORS (1)
190# define JO_VDP1_OPTION_USE_TEXTURE (1 << 2)
196# define JO_VDP1_SPRITE_NO_FLIP ((0) | JO_VDP1_FUNCTION_TEXTURE | (JO_VDP1_OPTION_USE_TEXTURE << 16))
198# define JO_VDP1_SPRITE_H_FLIP ((1 << 4) | JO_VDP1_FUNCTION_TEXTURE | (JO_VDP1_OPTION_USE_TEXTURE << 16))
200# define JO_VDP1_SPRITE_V_FLIP ((1 << 5) | JO_VDP1_FUNCTION_TEXTURE | (JO_VDP1_OPTION_USE_TEXTURE << 16))
202# define JO_VDP1_SPRITE_HV_FLIP ((3 << 4) | JO_VDP1_FUNCTION_TEXTURE | (JO_VDP1_OPTION_USE_TEXTURE << 16))
204# define JO_VDP1_POLYGON ((int)(JO_VDP1_FUNCTION_POLYGON | ((unsigned int)(JO_VDP1_END_CODE_DISABLE | JO_VDP1_TRANSPARENT_PIXEL_DISABLE) << 24)))
206# define JO_VDP1_POLYLINE ((int)(JO_VDP1_FUNCTION_POLYLINE | ((unsigned int)(JO_VDP1_END_CODE_DISABLE | JO_VDP1_TRANSPARENT_PIXEL_DISABLE) << 24)))
208# define JO_VDP1_LINE ((int)(JO_VDP1_FUNCTION_LINE | ((unsigned int)(JO_VDP1_END_CODE_DISABLE | JO_VDP1_TRANSPARENT_PIXEL_DISABLE) << 24)))
213# define JO_VDP1_DIRECTION_COMMAND(DIRECTION) ((DIRECTION) & (JO_VDP1_DIRECTION_FUNCTION_MASK | JO_VDP1_DIRECTION_FLIP_MASK))
217# define JO_VDP1_DIRECTION_OPTIONS(DIRECTION) (((DIRECTION) >> 16) & 0x1c)
221# define JO_VDP1_DIRECTION_DRAW_MODE(DIRECTION) (((DIRECTION) >> 24) & (JO_VDP1_END_CODE_DISABLE | JO_VDP1_TRANSPARENT_PIXEL_DISABLE))
240# define JO_VDP1_SPRITE_ATTRIBUTE(TEXTURE, COLOR, GOURAUD, DRAW_MODE, DIRECTION) \
241 {(TEXTURE), (DRAW_MODE) | JO_VDP1_DIRECTION_DRAW_MODE(DIRECTION), (COLOR), (GOURAUD), JO_VDP1_DIRECTION_COMMAND(DIRECTION)}
254# define JO_VDP1_LIGHT_TABLE_OFFSET (0x7FF00)
257# define JO_VDP1_CLIP_GOURAUD_TABLE_OFFSET (0x7E700)
259# define JO_VDP1_CLIP_GOURAUD_TABLE_COUNT (768)
279# define JO_VDP1_WINDOW_COUNT (4)
283# define JO_VDP1_OFF_SCREEN_WINDOW (3)
302# define JO_VDP1_MAX_KEY (0xffff)
335 const short zlimit,
const short center_x,
const short center_y);
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition types.h:39
int jo_fixed
Fixed point Q16.16 number.
Definition types.h:59
unsigned short draw_mode
Definition vdp1_command_pipeline.h:227
short bottom
Definition vdp1_command_pipeline.h:267
void __jo_vdp1_set_window(const short left, const short top, const short right, const short bottom, const short zlimit, const short center_x, const short center_y)
Set the current 3D window (internal usage).
short yc
Definition vdp1_command_pipeline.h:74
short left
Definition vdp1_command_pipeline.h:264
unsigned short clip_mode
Definition vdp1_command_pipeline.h:271
void jo_3d_set_depth_limit(const int z)
Depth limit of the current window (the far clipping distance of jo_3d_window()): the polygons beyond ...
short xd
Definition vdp1_command_pipeline.h:75
short ya
Definition vdp1_command_pipeline.h:70
unsigned short grda
Definition vdp1_command_pipeline.h:77
jo_fixed scale_x
Definition vdp1_command_pipeline.h:249
jo_fixed x
Definition vdp1_command_pipeline.h:246
jo_fixed __jo_vdp1_near_z
Near clipping distance (internal usage, see __jo_vdp1_near_clip()).
bool __jo_vdp1_frame_clear
The frame buffer is cleared at the start of each frame (see jo_3d_set_frame_clear()).
short origin_x
Definition vdp1_command_pipeline.h:272
short yb
Definition vdp1_command_pipeline.h:72
short yd
Definition vdp1_command_pipeline.h:76
bool __jo_vdp1_wireframe
Wireframe mode (internal usage, see jo_3d_set_wireframe()).
jo_fixed zlimit
Definition vdp1_command_pipeline.h:270
unsigned short gouraud_table
Definition vdp1_command_pipeline.h:229
jo_fixed __jo_vdp1_projection_distance
Projection distance in Q16.16 (internal usage, see jo_3d_perspective_angle()).
static __jo_force_inline void __jo_vdp1_update_near_clip(void)
Compute the near clipping distance (internal usage).
Definition vdp1_command_pipeline.h:318
void __jo_vdp1_set_window_clip(const bool clip)
The 3D polygons of the current window clipped to its rectangle (internal usage, see jo_3d_window_clip...
short xb
Definition vdp1_command_pipeline.h:71
int jo_vdp1_command_count(void)
VDP1 commands of the last frame (the polygons, their parts, the sprites: see jo_vdp1_command_max()).
short xa
Definition vdp1_command_pipeline.h:69
unsigned short ctrl
Definition vdp1_command_pipeline.h:63
int __jo_vdp1_depth_bias
Depth added to the keys of the commands (see jo_3d_set_depth_bias()).
unsigned short __jo_vdp1_display_level
Near clipping divisor (internal usage, see jo_3d_display_level()).
static __jo_force_inline void __jo_vdp1_select_window(const int window)
Select the 3D window used by the next commands (internal usage).
Definition vdp1_command_pipeline.h:370
short right
Definition vdp1_command_pipeline.h:266
int __jo_vdp1_current_window
Current 3D window (internal usage).
bool __jo_vdp1_windows_apart
The windows drawn one after the other (internal usage, see jo_3d_set_windows_apart()).
unsigned short direction
Definition vdp1_command_pipeline.h:230
unsigned short color
Definition vdp1_command_pipeline.h:228
unsigned short size
Definition vdp1_command_pipeline.h:68
#define JO_VDP1_WINDOW_COUNT
Number of 3D windows: near (default), far, a second far window and the window of the transparency lay...
Definition vdp1_command_pipeline.h:279
unsigned short texture_id
Definition vdp1_command_pipeline.h:226
unsigned short link
Definition vdp1_command_pipeline.h:64
short center_x
Definition vdp1_command_pipeline.h:268
static __jo_force_inline void jo_3d_set_frame_clear(const bool enabled)
Clear the frame buffer at the start of each frame (the default), or not.
Definition vdp1_command_pipeline.h:359
jo_fixed y
Definition vdp1_command_pipeline.h:247
jo_fixed scale_y
Definition vdp1_command_pipeline.h:250
short top
Definition vdp1_command_pipeline.h:265
unsigned short reserved
Definition vdp1_command_pipeline.h:78
void jo_vdp1_redraw_last_frame(void)
Draw the last frame again (from a VBLANK callback while the main loop doesn't run: a loading)....
unsigned short pmod
Definition vdp1_command_pipeline.h:65
bool screen
Definition vdp1_command_pipeline.h:274
short xc
Definition vdp1_command_pipeline.h:73
int jo_vdp1_frame_command_count(void)
VDP1 commands of the frame being made now by the master CPU (the polygons, their parts,...
short center_y
Definition vdp1_command_pipeline.h:269
short origin_y
Definition vdp1_command_pipeline.h:273
unsigned short colr
Definition vdp1_command_pipeline.h:66
jo_fixed z
Definition vdp1_command_pipeline.h:248
int jo_vdp1_command_max(void)
Most VDP1 commands in a frame (the next ones are not drawn).
unsigned short srca
Definition vdp1_command_pipeline.h:67
VDP1 command (32 bytes).
Definition vdp1_command_pipeline.h:62
Sprite attribute.
Definition vdp1_command_pipeline.h:225
Sprite position (internal usage).
Definition vdp1_command_pipeline.h:245
3D window (internal usage)
Definition vdp1_command_pipeline.h:263