mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-12-22 01:26:17 +01:00
Add todos
This commit is contained in:
parent
9a24ad5ade
commit
2f6e21e3d8
3 changed files with 49 additions and 21 deletions
45
small3dlib.h
45
small3dlib.h
|
@ -185,16 +185,29 @@ typedef uint16_t S3L_Index;
|
|||
S3L_Z_BUFFER_*. */
|
||||
#endif
|
||||
|
||||
#if S3L_Z_BUFFER == S3L_Z_BUFFER_FULL
|
||||
#define S3L_COMPUTE_DEPTH 1
|
||||
#define S3L_MAX_DEPTH 2147483647
|
||||
S3L_Unit S3L_zBuffer[S3L_RESOLUTION_X * S3L_RESOLUTION_Y];
|
||||
#define S3L_zBufferFormat(depth) (depth)
|
||||
#elif S3L_Z_BUFFER == S3L_Z_BUFFER_BYTE
|
||||
#define S3L_COMPUTE_DEPTH 1
|
||||
#define S3L_MAX_DEPTH 255
|
||||
uint8_t S3L_zBuffer[S3L_RESOLUTION_X * S3L_RESOLUTION_Y];
|
||||
#define S3L_zBufferFormat(depth) (((depth) >> 5) & 0x000000FF)
|
||||
#define S3L_SORT_NONE 0 /**< Don't sort triangles. This is fastest. */
|
||||
#define S3L_SORT_BACK_TO_FRONT 1 /**< Sort triangles from back to front. This
|
||||
can in most cases solve visibility
|
||||
without requiring almost any extra
|
||||
memory compared to z-buffer. */
|
||||
#define S3L_SORT_FRONT_TO_BACK 2 /**< Sort triangles front to back AND use
|
||||
a 1bit stencil buffer to not draw over
|
||||
already drawn triangles. This prevents
|
||||
overwriting already computed pixels, but
|
||||
requires a little but extra memory (the
|
||||
stencil buffer). */
|
||||
#ifndef S3L_SORT
|
||||
#define S3L_SORT S3L_SORT_NONE /**< Defines how to sort triangles before
|
||||
drawing a frame. This can be used to solve
|
||||
visibility in case z-buffer is not used, to
|
||||
prevent overwrting already rasterized
|
||||
pixels, implement transparency etc. Note
|
||||
that for simplicity and performance a
|
||||
relatively simple sorting is used which
|
||||
doesn't work completely correctly, so
|
||||
mistakes can occur (even the best sorting
|
||||
wouldn't be able to solve e.g. intersecting
|
||||
triangles). */
|
||||
#endif
|
||||
|
||||
#ifndef S3L_NEAR
|
||||
|
@ -509,6 +522,18 @@ static inline void S3L_rotate2DPoint(S3L_Unit *x, S3L_Unit *y, S3L_Unit angle);
|
|||
//=============================================================================
|
||||
// privates
|
||||
|
||||
#if S3L_Z_BUFFER == S3L_Z_BUFFER_FULL
|
||||
#define S3L_COMPUTE_DEPTH 1
|
||||
#define S3L_MAX_DEPTH 2147483647
|
||||
S3L_Unit S3L_zBuffer[S3L_RESOLUTION_X * S3L_RESOLUTION_Y];
|
||||
#define S3L_zBufferFormat(depth) (depth)
|
||||
#elif S3L_Z_BUFFER == S3L_Z_BUFFER_BYTE
|
||||
#define S3L_COMPUTE_DEPTH 1
|
||||
#define S3L_MAX_DEPTH 255
|
||||
uint8_t S3L_zBuffer[S3L_RESOLUTION_X * S3L_RESOLUTION_Y];
|
||||
#define S3L_zBufferFormat(depth) (((depth) >> 5) & 0x000000FF)
|
||||
#endif
|
||||
|
||||
#define S3L_COMPUTE_LERP_DEPTH\
|
||||
(S3L_COMPUTE_DEPTH && (S3L_PERSPECTIVE_CORRECTION != 1))
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#define S3L_Z_BUFFER S3L_Z_BUFFER_FULL
|
||||
#define S3L_Z_BUFFER 0
|
||||
|
||||
#define S3L_PIXEL_FUNCTION drawPixel
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
#define S3L_RESOLUTION_Y 480
|
||||
|
||||
#define S3L_COMPUTE_DEPTH 1
|
||||
#define S3L_PERSPECTIVE_CORRECTION 1
|
||||
#define S3L_PERSPECTIVE_CORRECTION 0
|
||||
|
||||
#include "small3dlib.h"
|
||||
|
||||
|
|
21
todo.txt
21
todo.txt
|
@ -1,14 +1,17 @@
|
|||
features:
|
||||
|
||||
- scene and model rendering strategies:
|
||||
- random (no visibility checks)
|
||||
- sorted:
|
||||
- back-to-front (slower, better memory efficiency)
|
||||
- front-to-back (faster, but needs 1bit stencil buffer)
|
||||
- Z-buffer:
|
||||
- full DONE
|
||||
- reduced (resolution and precision) DONE
|
||||
- more reduced (4-bit)
|
||||
- scene and model rendering strategies, that can be optionally selected and
|
||||
will configure other constants (e.g. a "low memory sort strategy" will turn
|
||||
z-buffer off and turn back-to-front sorting on).
|
||||
|
||||
- triangle sorting:
|
||||
- back-to-front (slower, better memory efficiency)
|
||||
- front-to-back (faster, but needs 1bit stencil buffer)
|
||||
|
||||
- Z-buffer:
|
||||
- full DONE
|
||||
- reduced (resolution and precision) DONE
|
||||
- more reduced (4-bit)
|
||||
|
||||
- perspective correction modes:
|
||||
- none DONE
|
||||
|
|
Loading…
Reference in a new issue