Jo Engine 2026.11.6
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
vdp1_command_pipeline.h File Reference

VDP1 command table handling. More...

Go to the source code of this file.

Data Structures

struct  jo_vdp1_command
 VDP1 command (32 bytes). More...
struct  jo_vdp1_sprite_attribute
 Sprite attribute. More...
struct  jo_vdp1_sprite_position
 Sprite position (internal usage). More...
struct  jo_vdp1_window
 3D window (internal usage) More...

Macros

#define JO_VDP1_MAX_COMMANDS
 Maximum commands per frame (sprites, polygons, the headers of the windows). Each one costs 36 bytes of RAM per command buffer (2 buffers with the second CPU) + 4 bytes for the sort; the 3D of the slave CPU can write JO_VDP1_MAX_COMMANDS - 40 commands.
#define JO_VDP1_CMD_NORMAL_SPRITE
 VDP1 command types (CMDCTRL).
#define JO_VDP1_CMD_SCALED_SPRITE
#define JO_VDP1_CMD_DISTORTED_SPRITE
#define JO_VDP1_CMD_POLYGON
#define JO_VDP1_CMD_POLYLINE
#define JO_VDP1_CMD_LINE
#define JO_VDP1_CMD_USER_CLIP
#define JO_VDP1_CMD_SYSTEM_CLIP
#define JO_VDP1_CMD_LOCAL_COORD
#define JO_VDP1_CMD_SKIP_ASSIGN
#define JO_VDP1_CMD_END
#define JO_VDP1_FUNCTION_SPRITE
 Normal sprite.
#define JO_VDP1_FUNCTION_TEXTURE
 Textured polygon (distorted sprite).
#define JO_VDP1_FUNCTION_POLYGON
 Polygon.
#define JO_VDP1_FUNCTION_POLYLINE
 Polyline.
#define JO_VDP1_FUNCTION_LINE
 Line.
#define JO_VDP1_FUNCTION_USER_CLIP
 User clipping area.
#define JO_VDP1_FUNCTION_SYSTEM_CLIP
 System clipping area.
#define JO_VDP1_FUNCTION_LOCAL_COORDINATES
 Local coordinates.
#define JO_VDP1_DIRECTION_FUNCTION_MASK
 Drawing function mask of the direction attribute.
#define JO_VDP1_DIRECTION_FLIP_MASK
 Flip mask of the direction attribute (CMDCTRL layout).
#define JO_VDP1_H_FLIP
 Horizontal flip bit of the direction attribute (CMDCTRL layout).
#define JO_VDP1_MSB_ON
 Write the MSB of the frame buffer (shadow).
#define JO_VDP1_HIGH_SPEED_SHRINK
 High speed shrink.
#define JO_VDP1_PRE_CLIPPING_DISABLE
 Pre-clipping disabled: for a command entirely inside of the clipping area (the VDP1 tests each line of a command against the clipping area before it draws it: about 4 cycles per line, for nothing when no line is out of it; the pixels out of the clipping area are not drawn anyway).
#define JO_VDP1_NO_WINDOW
 No clipping window.
#define JO_VDP1_WINDOW_IN
 Draw inside the user clipping area.
#define JO_VDP1_WINDOW_OUT
 Draw outside the user clipping area.
#define JO_VDP1_MESH
 Mesh (screen door).
#define JO_VDP1_NO_MESH
 No mesh.
#define JO_VDP1_END_CODE_DISABLE
 Disable end code (texture).
#define JO_VDP1_RGB_END_CODE
 End code of the RGB textures: the VDP1 stops drawing a line after 2 end codes (see jo_sprite_add_end_codes()).
#define JO_VDP1_TRANSPARENT_PIXEL_DISABLE
 Disable transparent pixel (texture).
#define JO_VDP1_COLOR_MODE_16_BANK
 Texture color mode: 16 colors (color bank).
#define JO_VDP1_COLOR_MODE_16_LOOKUP
 Texture color mode: 16 colors (lookup table).
#define JO_VDP1_COLOR_MODE_64_BANK
 Texture color mode: 64 colors (color bank).
#define JO_VDP1_COLOR_MODE_128_BANK
 Texture color mode: 128 colors (color bank).
#define JO_VDP1_COLOR_MODE_256_BANK
 Texture color mode: 256 colors (color bank).
#define JO_VDP1_COLOR_MODE_RGB
 Texture color mode: RGB (32768 colors).
#define JO_VDP1_COLOR_MODE_MASK
 Color mode mask.
#define JO_VDP1_COLOR_CALC_REPLACE
 Color calculation: replace.
#define JO_VDP1_COLOR_CALC_SHADOW
 Color calculation: shadow.
#define JO_VDP1_COLOR_CALC_HALF_LUMINANCE
 Color calculation: half luminance.
#define JO_VDP1_COLOR_CALC_HALF_TRANSPARENT
 Color calculation: half transparent.
#define JO_VDP1_COLOR_CALC_GOURAUD
 Color calculation: gouraud shading.
#define JO_VDP1_COLOR_CALC_MASK
 Color calculation mask.
#define JO_VDP1_NO_GOURAUD
 No gouraud table.
#define JO_VDP1_NO_PALETTE
 No palette (color).
#define JO_VDP1_TEXTURE_SIZE_SHIFT_16_COLORS
 Texture size shift for 16 colors textures (4 bits per pixel).
#define JO_VDP1_TEXTURE_SIZE_SHIFT_256_COLORS
 Texture size shift for 64, 128 and 256 colors textures (8 bits per pixel).
#define JO_VDP1_TEXTURE_SIZE_SHIFT_32K_COLORS
 Texture size shift for RGB textures (16 bits per pixel).
#define JO_VDP1_OPTION_USE_TEXTURE
 Option (bits 16-23 of the direction attribute): the polygon is textured.
#define JO_VDP1_SPRITE_NO_FLIP
 Textured sprite without flip.
#define JO_VDP1_SPRITE_H_FLIP
 Textured sprite with horizontal flip.
#define JO_VDP1_SPRITE_V_FLIP
 Textured sprite with vertical flip.
#define JO_VDP1_SPRITE_HV_FLIP
 Textured sprite with horizontal and vertical flip.
#define JO_VDP1_POLYGON
 Flat color polygon.
#define JO_VDP1_POLYLINE
 Flat color polyline.
#define JO_VDP1_LINE
 Flat color line.
#define JO_VDP1_DIRECTION_COMMAND(DIRECTION)
 Command bits of a direction attribute (drawing function and flip).
#define JO_VDP1_DIRECTION_OPTIONS(DIRECTION)
 Options of a direction attribute (JO_VDP1_OPTION_USE_TEXTURE).
#define JO_VDP1_DIRECTION_DRAW_MODE(DIRECTION)
 Draw mode bits of a direction attribute (JO_VDP1_END_CODE_DISABLE, JO_VDP1_TRANSPARENT_PIXEL_DISABLE).
#define JO_VDP1_SPRITE_ATTRIBUTE(TEXTURE, COLOR, GOURAUD, DRAW_MODE, DIRECTION)
 Sprite attribute initializer.
#define JO_VDP1_LIGHT_TABLE_OFFSET
 Gouraud tables used for 3D lighting (32 brightness levels, 16 is neutral).
#define JO_VDP1_CLIP_GOURAUD_TABLE_OFFSET
 Gouraud tables of the parts of the 3D polygons clipped by the near plane or subdivided near the camera (2 sets: one per frame).
#define JO_VDP1_CLIP_GOURAUD_TABLE_COUNT
 Gouraud tables of the clipped and subdivided 3D polygons (8 bytes each).
#define JO_VDP1_WINDOW_COUNT
 Number of 3D windows: near (default), far, a second far window and the window of the transparency layer (see jo_3d_select_window()).
#define JO_VDP1_OFF_SCREEN_WINDOW
 The window that draws beyond the screen (the frame buffer at its right: the transparency layer, see jo/transparency.h): the system clipping of the other windows stays on the screen, whatever the system clipping area.
#define JO_VDP1_MAX_KEY
 Biggest depth key.

Functions

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). A texture of this frame changed by the callback is seen (the sand of an hourglass).
static __jo_force_inline void __jo_vdp1_update_near_clip (void)
 Compute the near clipping distance (internal usage).
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).
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 it are not drawn (all their vertices farther, in the view space). A wall that fills the screen: nothing behind it is seen, the polygons of the room behind it cost VDP1 time for nothing (up to 50 ms against a wall).
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.
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()).
static __jo_force_inline void __jo_vdp1_select_window (const int window)
 Select the 3D window used by the next commands (internal usage).
int jo_vdp1_command_count (void)
 VDP1 commands of the last frame (the polygons, their parts, the sprites: see jo_vdp1_command_max()).
int jo_vdp1_frame_command_count (void)
 VDP1 commands of the frame being made now by the master CPU (the polygons, their parts, the sprites added since the start of the frame, see jo_vdp1_command_count() for the last frame and jo_vdp1_command_max()).
int jo_vdp1_command_max (void)
 Most VDP1 commands in a frame (the next ones are not drawn).

Variables

int __jo_vdp1_current_window
 Current 3D window (internal usage).
jo_fixed __jo_vdp1_projection_distance
 Projection distance in Q16.16 (internal usage, see jo_3d_perspective_angle()).
unsigned short __jo_vdp1_display_level
 Near clipping divisor (internal usage, see jo_3d_display_level()).
int __jo_vdp1_depth_bias
 Depth added to the keys of the commands (see jo_3d_set_depth_bias()).
jo_fixed __jo_vdp1_near_z
 Near clipping distance (internal usage, see __jo_vdp1_near_clip()).
bool __jo_vdp1_wireframe
 Wireframe mode (internal usage, see jo_3d_set_wireframe()).
bool __jo_vdp1_windows_apart
 The windows drawn one after the other (internal usage, see jo_3d_set_windows_apart()).
bool __jo_vdp1_frame_clear
 The frame buffer is cleared at the start of each frame (see jo_3d_set_frame_clear()).

Detailed Description

VDP1 command table handling.

Author
Johannes Fetz
Bug
No known bugs.

Data Structure Documentation

◆ jo_vdp1_command

struct jo_vdp1_command

VDP1 command (32 bytes).

Data Fields
unsigned short colr
unsigned short ctrl
unsigned short grda
unsigned short link
unsigned short pmod
unsigned short reserved
unsigned short size
unsigned short srca
short xa
short xb
short xc
short xd
short ya
short yb
short yc
short yd

◆ jo_vdp1_sprite_attribute

struct jo_vdp1_sprite_attribute

Sprite attribute.

Data Fields
unsigned short color
unsigned short direction
unsigned short draw_mode
unsigned short gouraud_table
unsigned short texture_id

◆ jo_vdp1_sprite_position

struct jo_vdp1_sprite_position

Sprite position (internal usage).

Data Fields
jo_fixed scale_x
jo_fixed scale_y
jo_fixed x
jo_fixed y
jo_fixed z

◆ jo_vdp1_window

struct jo_vdp1_window

3D window (internal usage)

Data Fields
short bottom
short center_x
short center_y
unsigned short clip_mode
short left
short origin_x
short origin_y
short right
bool screen
short top
jo_fixed zlimit

Macro Definition Documentation

◆ JO_VDP1_CLIP_GOURAUD_TABLE_COUNT

#define JO_VDP1_CLIP_GOURAUD_TABLE_COUNT

Gouraud tables of the clipped and subdivided 3D polygons (8 bytes each).

◆ JO_VDP1_CLIP_GOURAUD_TABLE_OFFSET

#define JO_VDP1_CLIP_GOURAUD_TABLE_OFFSET

Gouraud tables of the parts of the 3D polygons clipped by the near plane or subdivided near the camera (2 sets: one per frame).

◆ JO_VDP1_CMD_DISTORTED_SPRITE

#define JO_VDP1_CMD_DISTORTED_SPRITE

◆ JO_VDP1_CMD_END

#define JO_VDP1_CMD_END

◆ JO_VDP1_CMD_LINE

#define JO_VDP1_CMD_LINE

◆ JO_VDP1_CMD_LOCAL_COORD

#define JO_VDP1_CMD_LOCAL_COORD

◆ JO_VDP1_CMD_NORMAL_SPRITE

#define JO_VDP1_CMD_NORMAL_SPRITE

VDP1 command types (CMDCTRL).

◆ JO_VDP1_CMD_POLYGON

#define JO_VDP1_CMD_POLYGON

◆ JO_VDP1_CMD_POLYLINE

#define JO_VDP1_CMD_POLYLINE

◆ JO_VDP1_CMD_SCALED_SPRITE

#define JO_VDP1_CMD_SCALED_SPRITE

◆ JO_VDP1_CMD_SKIP_ASSIGN

#define JO_VDP1_CMD_SKIP_ASSIGN

◆ JO_VDP1_CMD_SYSTEM_CLIP

#define JO_VDP1_CMD_SYSTEM_CLIP

◆ JO_VDP1_CMD_USER_CLIP

#define JO_VDP1_CMD_USER_CLIP

◆ JO_VDP1_COLOR_CALC_GOURAUD

#define JO_VDP1_COLOR_CALC_GOURAUD

Color calculation: gouraud shading.

◆ JO_VDP1_COLOR_CALC_HALF_LUMINANCE

#define JO_VDP1_COLOR_CALC_HALF_LUMINANCE

Color calculation: half luminance.

◆ JO_VDP1_COLOR_CALC_HALF_TRANSPARENT

#define JO_VDP1_COLOR_CALC_HALF_TRANSPARENT

Color calculation: half transparent.

◆ JO_VDP1_COLOR_CALC_MASK

#define JO_VDP1_COLOR_CALC_MASK

Color calculation mask.

◆ JO_VDP1_COLOR_CALC_REPLACE

#define JO_VDP1_COLOR_CALC_REPLACE

Color calculation: replace.

◆ JO_VDP1_COLOR_CALC_SHADOW

#define JO_VDP1_COLOR_CALC_SHADOW

Color calculation: shadow.

◆ JO_VDP1_COLOR_MODE_128_BANK

#define JO_VDP1_COLOR_MODE_128_BANK

Texture color mode: 128 colors (color bank).

◆ JO_VDP1_COLOR_MODE_16_BANK

#define JO_VDP1_COLOR_MODE_16_BANK

Texture color mode: 16 colors (color bank).

◆ JO_VDP1_COLOR_MODE_16_LOOKUP

#define JO_VDP1_COLOR_MODE_16_LOOKUP

Texture color mode: 16 colors (lookup table).

◆ JO_VDP1_COLOR_MODE_256_BANK

#define JO_VDP1_COLOR_MODE_256_BANK

Texture color mode: 256 colors (color bank).

◆ JO_VDP1_COLOR_MODE_64_BANK

#define JO_VDP1_COLOR_MODE_64_BANK

Texture color mode: 64 colors (color bank).

◆ JO_VDP1_COLOR_MODE_MASK

#define JO_VDP1_COLOR_MODE_MASK

Color mode mask.

◆ JO_VDP1_COLOR_MODE_RGB

#define JO_VDP1_COLOR_MODE_RGB

Texture color mode: RGB (32768 colors).

◆ JO_VDP1_DIRECTION_COMMAND

#define JO_VDP1_DIRECTION_COMMAND ( DIRECTION)

Command bits of a direction attribute (drawing function and flip).

Parameters
DIRECTIONJO_VDP1_SPRITE_NO_FLIP, JO_VDP1_POLYGON, etc

◆ JO_VDP1_DIRECTION_DRAW_MODE

#define JO_VDP1_DIRECTION_DRAW_MODE ( DIRECTION)

Draw mode bits of a direction attribute (JO_VDP1_END_CODE_DISABLE, JO_VDP1_TRANSPARENT_PIXEL_DISABLE).

Parameters
DIRECTIONJO_VDP1_SPRITE_NO_FLIP, JO_VDP1_POLYGON, etc

◆ JO_VDP1_DIRECTION_FLIP_MASK

#define JO_VDP1_DIRECTION_FLIP_MASK

Flip mask of the direction attribute (CMDCTRL layout).

◆ JO_VDP1_DIRECTION_FUNCTION_MASK

#define JO_VDP1_DIRECTION_FUNCTION_MASK

Drawing function mask of the direction attribute.

◆ JO_VDP1_DIRECTION_OPTIONS

#define JO_VDP1_DIRECTION_OPTIONS ( DIRECTION)

Options of a direction attribute (JO_VDP1_OPTION_USE_TEXTURE).

Parameters
DIRECTIONJO_VDP1_SPRITE_NO_FLIP, JO_VDP1_POLYGON, etc

◆ JO_VDP1_END_CODE_DISABLE

#define JO_VDP1_END_CODE_DISABLE

Disable end code (texture).

◆ JO_VDP1_FUNCTION_LINE

#define JO_VDP1_FUNCTION_LINE

Line.

◆ JO_VDP1_FUNCTION_LOCAL_COORDINATES

#define JO_VDP1_FUNCTION_LOCAL_COORDINATES

Local coordinates.

◆ JO_VDP1_FUNCTION_POLYGON

#define JO_VDP1_FUNCTION_POLYGON

Polygon.

◆ JO_VDP1_FUNCTION_POLYLINE

#define JO_VDP1_FUNCTION_POLYLINE

Polyline.

◆ JO_VDP1_FUNCTION_SPRITE

#define JO_VDP1_FUNCTION_SPRITE

Normal sprite.

◆ JO_VDP1_FUNCTION_SYSTEM_CLIP

#define JO_VDP1_FUNCTION_SYSTEM_CLIP

System clipping area.

◆ JO_VDP1_FUNCTION_TEXTURE

#define JO_VDP1_FUNCTION_TEXTURE

Textured polygon (distorted sprite).

◆ JO_VDP1_FUNCTION_USER_CLIP

#define JO_VDP1_FUNCTION_USER_CLIP

User clipping area.

◆ JO_VDP1_H_FLIP

#define JO_VDP1_H_FLIP

Horizontal flip bit of the direction attribute (CMDCTRL layout).

◆ JO_VDP1_HIGH_SPEED_SHRINK

#define JO_VDP1_HIGH_SPEED_SHRINK

High speed shrink.

◆ JO_VDP1_LIGHT_TABLE_OFFSET

#define JO_VDP1_LIGHT_TABLE_OFFSET

Gouraud tables used for 3D lighting (32 brightness levels, 16 is neutral).

◆ JO_VDP1_LINE

#define JO_VDP1_LINE

Flat color line.

◆ JO_VDP1_MAX_COMMANDS

#define JO_VDP1_MAX_COMMANDS

Maximum commands per frame (sprites, polygons, the headers of the windows). Each one costs 36 bytes of RAM per command buffer (2 buffers with the second CPU) + 4 bytes for the sort; the 3D of the slave CPU can write JO_VDP1_MAX_COMMANDS - 40 commands.

Remarks
Smaller in the makefile to save RAM (JO_VDP1_MAX_COMMANDS = 256: 30 KB less per buffer). 1000 at most (the command tables of the VRAM)

◆ JO_VDP1_MAX_KEY

#define JO_VDP1_MAX_KEY

Biggest depth key.

◆ JO_VDP1_MESH

#define JO_VDP1_MESH

Mesh (screen door).

◆ JO_VDP1_MSB_ON

#define JO_VDP1_MSB_ON

Write the MSB of the frame buffer (shadow).

◆ JO_VDP1_NO_GOURAUD

#define JO_VDP1_NO_GOURAUD

No gouraud table.

◆ JO_VDP1_NO_MESH

#define JO_VDP1_NO_MESH

No mesh.

◆ JO_VDP1_NO_PALETTE

#define JO_VDP1_NO_PALETTE

No palette (color).

◆ JO_VDP1_NO_WINDOW

#define JO_VDP1_NO_WINDOW

No clipping window.

◆ JO_VDP1_OFF_SCREEN_WINDOW

#define JO_VDP1_OFF_SCREEN_WINDOW

The window that draws beyond the screen (the frame buffer at its right: the transparency layer, see jo/transparency.h): the system clipping of the other windows stays on the screen, whatever the system clipping area.

◆ JO_VDP1_OPTION_USE_TEXTURE

#define JO_VDP1_OPTION_USE_TEXTURE

Option (bits 16-23 of the direction attribute): the polygon is textured.

◆ JO_VDP1_POLYGON

#define JO_VDP1_POLYGON

Flat color polygon.

◆ JO_VDP1_POLYLINE

#define JO_VDP1_POLYLINE

Flat color polyline.

◆ JO_VDP1_PRE_CLIPPING_DISABLE

#define JO_VDP1_PRE_CLIPPING_DISABLE

Pre-clipping disabled: for a command entirely inside of the clipping area (the VDP1 tests each line of a command against the clipping area before it draws it: about 4 cycles per line, for nothing when no line is out of it; the pixels out of the clipping area are not drawn anyway).

◆ JO_VDP1_RGB_END_CODE

#define JO_VDP1_RGB_END_CODE

End code of the RGB textures: the VDP1 stops drawing a line after 2 end codes (see jo_sprite_add_end_codes()).

◆ JO_VDP1_SPRITE_ATTRIBUTE

#define JO_VDP1_SPRITE_ATTRIBUTE ( TEXTURE,
COLOR,
GOURAUD,
DRAW_MODE,
DIRECTION )

Sprite attribute initializer.

Parameters
TEXTURESprite id
COLORRGB color or palette
GOURAUDGouraud table address / 8 (JO_VDP1_NO_GOURAUD)
DRAW_MODEJO_VDP1_COLOR_MODE_xxx | JO_VDP1_COLOR_CALC_xxx | ...
DIRECTIONJO_VDP1_SPRITE_NO_FLIP, JO_VDP1_POLYGON, etc

◆ JO_VDP1_SPRITE_H_FLIP

#define JO_VDP1_SPRITE_H_FLIP

Textured sprite with horizontal flip.

◆ JO_VDP1_SPRITE_HV_FLIP

#define JO_VDP1_SPRITE_HV_FLIP

Textured sprite with horizontal and vertical flip.

◆ JO_VDP1_SPRITE_NO_FLIP

#define JO_VDP1_SPRITE_NO_FLIP

Textured sprite without flip.

◆ JO_VDP1_SPRITE_V_FLIP

#define JO_VDP1_SPRITE_V_FLIP

Textured sprite with vertical flip.

◆ JO_VDP1_TEXTURE_SIZE_SHIFT_16_COLORS

#define JO_VDP1_TEXTURE_SIZE_SHIFT_16_COLORS

Texture size shift for 16 colors textures (4 bits per pixel).

◆ JO_VDP1_TEXTURE_SIZE_SHIFT_256_COLORS

#define JO_VDP1_TEXTURE_SIZE_SHIFT_256_COLORS

Texture size shift for 64, 128 and 256 colors textures (8 bits per pixel).

◆ JO_VDP1_TEXTURE_SIZE_SHIFT_32K_COLORS

#define JO_VDP1_TEXTURE_SIZE_SHIFT_32K_COLORS

Texture size shift for RGB textures (16 bits per pixel).

◆ JO_VDP1_TRANSPARENT_PIXEL_DISABLE

#define JO_VDP1_TRANSPARENT_PIXEL_DISABLE

Disable transparent pixel (texture).

◆ JO_VDP1_WINDOW_COUNT

#define JO_VDP1_WINDOW_COUNT

Number of 3D windows: near (default), far, a second far window and the window of the transparency layer (see jo_3d_select_window()).

◆ JO_VDP1_WINDOW_IN

#define JO_VDP1_WINDOW_IN

Draw inside the user clipping area.

◆ JO_VDP1_WINDOW_OUT

#define JO_VDP1_WINDOW_OUT

Draw outside the user clipping area.

Function Documentation

◆ __jo_vdp1_select_window()

__jo_force_inline void __jo_vdp1_select_window ( const int window)
static

Select the 3D window used by the next commands (internal usage).

Parameters
window0 (near window), 1 (far window), 2 (second far window) or 3 (transparency layer)

◆ __jo_vdp1_set_window()

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).

Parameters
leftLeft clipping position (screen pixels)
topTop clipping position (screen pixels)
rightRight clipping position (screen pixels)
bottomBottom clipping position (screen pixels)
zlimitFar clipping distance
center_xHorizontal position of the projection center (screen pixels)
center_yVertical position of the projection center (screen pixels)
Remarks
Select the window with __jo_vdp1_select_window() first

◆ __jo_vdp1_set_window_clip()

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()).

◆ __jo_vdp1_update_near_clip()

__jo_force_inline void __jo_vdp1_update_near_clip ( void )
static

Compute the near clipping distance (internal usage).

Remarks
Must be called when __jo_vdp1_projection_distance or __jo_vdp1_display_level change

◆ jo_3d_set_depth_limit()

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 it are not drawn (all their vertices farther, in the view space). A wall that fills the screen: nothing behind it is seen, the polygons of the room behind it cost VDP1 time for nothing (up to 50 ms against a wall).

Parameters
zDepth limit (world units), -1: none (the default)
Remarks
Set it for the frame (the slave CPU draws in the same window); the mirrors use the far windows

◆ jo_3d_set_frame_clear()

__jo_force_inline void jo_3d_set_frame_clear ( const bool enabled)
static

Clear the frame buffer at the start of each frame (the default), or not.

Parameters
enabledfalse: the frame buffer is not cleared, what the frame does not draw keeps the pixels of the frame drawn 2 frames before (the frame buffers alternate)
Remarks
With JO_FRAMERATE > 1 or JO_FRAMERATE_DYNAMIC (the frame buffers change when the VDP1 finished a frame) the frame buffer is erased by the VDP1 during the VBLANK of the change (as many lines as the VBLANK allows, measured at the start: with Mednafen, 197 of 224 lines in NTSC, 114 of 240) and the lines left are cleared by a polygon of the transparent color (the whole screen: about 4 ms of VDP1 time; when the VBLANK erase can't be used, with a light gun) A program that covers the whole screen at each frame (the rooms of a first person game) does not need it. The last pixel of a line between 2 polygons is the one of the older frame instead of the background. With JO_FRAMERATE 1 the VDP1 erases the frame buffer itself
From the next frame

◆ jo_vdp1_command_count()

int jo_vdp1_command_count ( void )

VDP1 commands of the last frame (the polygons, their parts, the sprites: see jo_vdp1_command_max()).

◆ jo_vdp1_command_max()

int jo_vdp1_command_max ( void )

Most VDP1 commands in a frame (the next ones are not drawn).

◆ jo_vdp1_frame_command_count()

int jo_vdp1_frame_command_count ( void )

VDP1 commands of the frame being made now by the master CPU (the polygons, their parts, the sprites added since the start of the frame, see jo_vdp1_command_count() for the last frame and jo_vdp1_command_max()).

Returns
Command count
Remarks
The commands of the slave CPU are added at jo_3d_slave_end(). The commands of an object: the count after its drawing minus the count before it (a budget: draw a far object simpler when the frame has few commands left)

◆ jo_vdp1_redraw_last_frame()

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). A texture of this frame changed by the callback is seen (the sand of an hourglass).

Remarks
The manual change of the frame buffers (JO_FRAMERATE > 1) draws a frame only once: the frame buffers change at the end of this VBLANK if the VDP1 finished the frame. Don't call it while the main loop sends frames

Variable Documentation

◆ __jo_vdp1_current_window

int __jo_vdp1_current_window
extern

Current 3D window (internal usage).

◆ __jo_vdp1_depth_bias

int __jo_vdp1_depth_bias
extern

Depth added to the keys of the commands (see jo_3d_set_depth_bias()).

◆ __jo_vdp1_display_level

unsigned short __jo_vdp1_display_level
extern

Near clipping divisor (internal usage, see jo_3d_display_level()).

◆ __jo_vdp1_frame_clear

bool __jo_vdp1_frame_clear
extern

The frame buffer is cleared at the start of each frame (see jo_3d_set_frame_clear()).

◆ __jo_vdp1_near_z

jo_fixed __jo_vdp1_near_z
extern

Near clipping distance (internal usage, see __jo_vdp1_near_clip()).

◆ __jo_vdp1_projection_distance

jo_fixed __jo_vdp1_projection_distance
extern

Projection distance in Q16.16 (internal usage, see jo_3d_perspective_angle()).

◆ __jo_vdp1_windows_apart

bool __jo_vdp1_windows_apart
extern

The windows drawn one after the other (internal usage, see jo_3d_set_windows_apart()).

◆ __jo_vdp1_wireframe

bool __jo_vdp1_wireframe
extern

Wireframe mode (internal usage, see jo_3d_set_wireframe()).