embedded-software
reusable software modules for embedded systems
|
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | point |
struct | vector |
struct | camera |
struct | triangle |
struct | world |
struct | framebuffer |
enum | pixel_color { Black = 40, Red, Green, Yellow, Blue, Magenta, Cyan, White } |
typedef float | rounding_t |
typedef struct point | point_t |
typedef struct vector | vector_t |
typedef struct camera | camera_t |
typedef struct triangle | triangle_t |
typedef struct world | world_t |
typedef struct framebuffer | framebuffer_t |
void | Render_Engine_RenderFrame (world_t *world, camera_t *camera, framebuffer_t *framebuffer) |
Render a frame. More... | |
void | Render_Engine_DisplayFrame (uint8_t channel, framebuffer_t *framebuffer) |
Display a frame. More... | |
Created on March 21, 2019
Use this module to perform 3D rendering on the processor. Processing can take quite some time and is blocking. Little error checking is performed yet.
Calculations may not be 100% accurate, but is sufficient for the character terminal based output. Normal usage is:
The following code can be used to display a pyramid onscreen. The camera rotates around it to show all the sides. This example can easily be modified to rotate the camera inside the pyramid.
typedef struct framebuffer framebuffer_t |
typedef float rounding_t |
typedef struct triangle triangle_t |
enum pixel_color |
void Render_Engine_DisplayFrame | ( | uint8_t | channel, |
framebuffer_t * | framebuffer | ||
) |
Display a frame.
Output the contents of a framebuffer over a UART channel. Before writing, this function makes sure the UART buffer is empty. As there is so much data sent over UART, buffers get in the way of operation. This directly accesses the HAL UART code to get around the buffer of the UART code. This method is blocking during the writing process.
channel | UART channel to output the framebuffer over. |
framebuffer | Framebuffer to display on the console. |
void Render_Engine_RenderFrame | ( | world_t * | world, |
camera_t * | camera, | ||
framebuffer_t * | framebuffer | ||
) |
Render a frame.
Renders a frame of data based on a list of triangles in the world object. Make sure the array in the framebuffer has been created as this will not create the needed array for you. This method is blocking during the rendering process.
world | World data that contains the list of triangles in 3D space to render. |
camera | Camera data that contains the location and direction of the camera. |
framebuffer | Output of the rendering process populates an existing framebuffer. |