From 3e653ef743986233c38a535d743b99580b251890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Mon, 24 Jun 2019 20:49:00 +0200 Subject: [PATCH] Remove unused stuff --- small3dlib.h | 78 ++-------------------------------------------------- todo.txt | 6 ++-- 2 files changed, 5 insertions(+), 79 deletions(-) diff --git a/small3dlib.h b/small3dlib.h index d1d6b26..7edc672 100644 --- a/small3dlib.h +++ b/small3dlib.h @@ -1646,21 +1646,6 @@ void S3L_initDrawConfig(S3L_DrawConfig *config) static inline void S3L_PIXEL_FUNCTION(S3L_PixelInfo *pixel); // forward decl -typedef struct -{ - int16_t steps; - int16_t err; - S3L_ScreenCoord x; - S3L_ScreenCoord y; - - int16_t *majorCoord; - int16_t *minorCoord; - int16_t majorIncrement; - int16_t minorIncrement; - int16_t majorDiff; - int16_t minorDiff; -} S3L_BresenhamState; ///< State of drawing a line with Bresenham algorithm. - /** Serves to accelerate linear interpolation for performance-critical code. Functions such as S3L_interpolate require division to compute each interpolated value, while S3L_FastLerpState only requires a division for @@ -1699,65 +1684,6 @@ static inline S3L_Unit S3L_interpolateBarycentric( ) / S3L_FRACTIONS_PER_UNIT; } -void S3L_bresenhamInit(S3L_BresenhamState *state, int16_t x0, int16_t y0, - int16_t x1, int16_t y1) -{ - int16_t dx = x1 - x0; - int16_t dy = y1 - y0; - - int16_t absDx = S3L_abs(dx); - int16_t absDy = S3L_abs(dy); - - if (absDx >= absDy) - { - state->majorCoord = &(state->x); - state->minorCoord = &(state->y); - - state->minorDiff = 2 * absDy; - state->majorDiff = 2 * absDx; - state->err = 2 * dy - dx; - - state->majorIncrement = dx >= 0 ? 1 : -1; - state->minorIncrement = dy >= 0 ? 1 : -1; - - state->steps = absDx; - } - else - { - state->majorCoord = &(state->y); - state->minorCoord = &(state->x); - - state->minorDiff = 2 * absDx; - state->majorDiff = 2 * absDy; - state->err = 2 * dx - dy; - - state->majorIncrement = dy >= 0 ? 1 : -1; - state->minorIncrement = dx >= 0 ? 1 : -1; - - state->steps = absDy; - } - - state->x = x0; - state->y = y0; -} - -int S3L_bresenhamStep(S3L_BresenhamState *state) -{ - state->steps--; - - (*state->majorCoord) += state->majorIncrement; - - if (state->err > 0) - { - (*state->minorCoord) += state->minorIncrement; - state->err -= state->majorDiff; - } - - state->err += state->minorDiff; - - return state->steps >= 0; -} - void S3L_mapProjectionPlaneToScreen( S3L_Vec4 point, S3L_ScreenCoord *screenX, @@ -2465,9 +2391,9 @@ typedef struct uint8_t modelIndex; S3L_Index triangleIndex; uint16_t sortValue; -} S3L_TriangleToSort; +} _S3L_TriangleToSort; -S3L_TriangleToSort S3L_sortArray[S3L_MAX_TRIANGES_DRAWN]; +_S3L_TriangleToSort S3L_sortArray[S3L_MAX_TRIANGES_DRAWN]; uint16_t S3L_sortArrayLength; #endif diff --git a/todo.txt b/todo.txt index 3cee3d1..5f913ef 100644 --- a/todo.txt +++ b/todo.txt @@ -5,7 +5,7 @@ features: back-to-front sorting on). - Helper functions for e.g. retrieving and caching UV coords etc. Maybe these - should be in a separate file? + should be in a separate file? DONE - objtool: An option to parse material groups and generate an array of per-triangle material indices. DONE @@ -70,9 +70,9 @@ features: - create demos: - model viewer DONE - - game-like demo (GTA-style, Quake style etc.) + - game-like demo (GTA-style, Quake style etc.) DONE - offline HQ (lerp texuring, normal mapping, reflections, ...) rendering - to PPM image file + to PPM image file DONE - drawModel: create an option that would use a cache to not transform the same point twice