1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/small3dlib.git synced 2024-11-23 20:59:58 +01:00

Remove unused stuff

This commit is contained in:
Miloslav Číž 2019-06-24 20:49:00 +02:00
parent 616914dd6d
commit 3e653ef743
2 changed files with 5 additions and 79 deletions

View file

@ -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

View file

@ -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