Jo Engine
2024.04.28
Jo Sega Saturn Engine
|
Fast Triangle based software renderer using fixed number. More...
Go to the source code of this file.
Data Structures | |
struct | jo_software_renderer_gfx |
This is the main struct that handle everything for drawing. More... | |
struct | jo_software_renderer_vertex |
Vertex. More... | |
struct | jo_software_renderer_triangle |
Triangle definition. More... | |
Enumerations | |
enum | jo_software_renderer_draw_mode { JO_SR_DRAW_TEXTURED, JO_SR_DRAW_FLAT, JO_SR_DRAW_WIREFRAME } |
Draw mode. More... | |
enum | jo_software_renderer_face_culling_mode { JO_SR_BACK_FACE_CULLING, JO_SR_FRONT_FACE_CULLING, JO_SR_NO_FACE_CULLING } |
Face culling mode. More... | |
enum | jo_software_renderer_depth_mode { JO_SR_DEPTH_IGNORE, JO_SR_DEPTH_LESS, JO_SR_DEPTH_LESS_OR_EQUAL, JO_SR_DEPTH_GREATER_OR_EQUAL, JO_SR_DEPTH_GREATER, JO_SR_DEPTH_NOT_EQUAL, JO_SR_DEPTH_EQUAL } |
Z-BUFFER Computation mode. More... | |
Functions | |
jo_software_renderer_gfx * | jo_software_renderer_create_ex (unsigned short width, unsigned short height, const jo_scroll_screen screen, const bool enable_zbuffer) |
Create a full-color rendering surface. More... | |
static __jo_force_inline jo_software_renderer_gfx * | jo_software_renderer_create (unsigned short width, unsigned short height, const jo_scroll_screen screen) |
Create a full-color rendering surface. More... | |
void | jo_software_renderer_free (jo_software_renderer_gfx *const gfx) |
Free the rendering surface. More... | |
void | jo_software_renderer_flush (jo_software_renderer_gfx *const gfx) |
Copy the buffer into VDP1/2 VRAM. More... | |
void | jo_software_renderer_clear (const jo_software_renderer_gfx *const gfx, const jo_color color) |
Clear the buffer with the given color. More... | |
void | jo_software_renderer_draw_pixel2D (const jo_software_renderer_gfx *const gfx, const jo_fixed x, const jo_fixed y, const jo_color color) |
Draw a pixel without handling the Z-Buffer. More... | |
void | jo_software_renderer_draw_pixel3D (const jo_software_renderer_gfx *const gfx, const jo_fixed x, const jo_fixed y, const jo_fixed z, const jo_color color) |
Draw a pixel. More... | |
void | jo_software_renderer_draw_line3D (const jo_software_renderer_gfx *const gfx, jo_fixed x0, jo_fixed y0, jo_fixed z0, jo_fixed x1, jo_fixed y1, jo_fixed z1, const jo_color color0, const jo_color color1) |
Draw a line. More... | |
void | jo_software_renderer_draw_triangle (const jo_software_renderer_gfx *const gfx, const jo_software_renderer_triangle *const triangle, const jo_matrix *const transform_matrix) |
static __jo_force_inline void | jo_software_renderer_draw_triangle_wireframe (const jo_software_renderer_gfx *const gfx, const jo_software_renderer_triangle *const triangle) |
Draw a triangle in wireframe. More... | |
Fast Triangle based software renderer using fixed number.
struct jo_software_renderer_gfx |
This is the main struct that handle everything for drawing.
Data Fields | ||
---|---|---|
jo_size | clipping_size | |
jo_color * | color_buffer | |
unsigned int | color_buffer_size | |
jo_fixed * | depth_buffer | |
unsigned int | depth_buffer_dword_size | |
jo_software_renderer_depth_mode | depth_mode_testing | |
jo_software_renderer_draw_mode | draw_mode | |
jo_software_renderer_face_culling_mode | face_culling_mode | |
int | sprite_id | |
void * | vram | |
jo_size | vram_size |
struct jo_software_renderer_vertex |
Vertex.
Data Fields | ||
---|---|---|
jo_color | color | |
jo_vector4_fixed | pos | |
jo_vector2_fixed | uv_texture_mapping |
struct jo_software_renderer_triangle |
Triangle definition.
Data Fields | ||
---|---|---|
int | sprite_id | |
jo_software_renderer_vertex | v0 | |
jo_software_renderer_vertex | v1 | |
jo_software_renderer_vertex | v2 |
void jo_software_renderer_clear | ( | const jo_software_renderer_gfx *const | gfx, |
const jo_color | color | ||
) |
Clear the buffer with the given color.
gfx | Software Rendering Graphics |
color | Color |
|
static |
Create a full-color rendering surface.
width | Surface width |
height | Surface height |
screen | Drawing destination. Only JO_SPRITE_SCREEN and JO_NBG1_SCREEN are supported today |
jo_software_renderer_gfx* jo_software_renderer_create_ex | ( | unsigned short | width, |
unsigned short | height, | ||
const jo_scroll_screen | screen, | ||
const bool | enable_zbuffer | ||
) |
Create a full-color rendering surface.
width | Surface width |
height | Surface height |
screen | Drawing destination. Only JO_SPRITE_SCREEN and JO_NBG1_SCREEN are supported today |
enable_zbuffer | Enable Z buffer (use a lot of RAM depending on the size of the surface) |
void jo_software_renderer_draw_line3D | ( | const jo_software_renderer_gfx *const | gfx, |
jo_fixed | x0, | ||
jo_fixed | y0, | ||
jo_fixed | z0, | ||
jo_fixed | x1, | ||
jo_fixed | y1, | ||
jo_fixed | z1, | ||
const jo_color | color0, | ||
const jo_color | color1 | ||
) |
Draw a line.
gfx | Software Rendering Graphics |
x0 | X0 Fixed position (point A) |
y0 | Y0 Fixed position (point A) |
z0 | Z0 Fixed position (point A) |
x1 | X2 Fixed position (point B) |
y1 | Y2 Fixed position (point B) |
z1 | Z2 Fixed position (point B) |
color0 | First color (point A) |
color1 | Second color (point B) |
void jo_software_renderer_draw_pixel2D | ( | const jo_software_renderer_gfx *const | gfx, |
const jo_fixed | x, | ||
const jo_fixed | y, | ||
const jo_color | color | ||
) |
Draw a pixel without handling the Z-Buffer.
gfx | Software Rendering Graphics |
x | X Fixed position |
y | Y Fixed position |
color | Pixel color |
void jo_software_renderer_draw_pixel3D | ( | const jo_software_renderer_gfx *const | gfx, |
const jo_fixed | x, | ||
const jo_fixed | y, | ||
const jo_fixed | z, | ||
const jo_color | color | ||
) |
Draw a pixel.
gfx | Software Rendering Graphics |
x | X Fixed position |
y | Y Fixed position |
z | Z Fixed position |
color | Pixel color |
void jo_software_renderer_draw_triangle | ( | const jo_software_renderer_gfx *const | gfx, |
const jo_software_renderer_triangle *const | triangle, | ||
const jo_matrix *const | transform_matrix | ||
) |
|
static |
Draw a triangle in wireframe.
gfx | Software Rendering Graphics |
triangle | Triangle |
void jo_software_renderer_flush | ( | jo_software_renderer_gfx *const | gfx | ) |
Copy the buffer into VDP1/2 VRAM.
gfx | Software Rendering Graphics |
void jo_software_renderer_free | ( | jo_software_renderer_gfx *const | gfx | ) |
Free the rendering surface.
gfx | Software Rendering Graphics |