Handle buddy tris

This commit is contained in:
Miloslav Ciz 2025-05-12 20:24:27 +02:00
parent f07a4d3635
commit 0e34b2c52c
3 changed files with 25 additions and 1 deletions

View file

@ -4,6 +4,7 @@ fuck issue trackers :D
- hitting ramps at higher speed still often bugs, try to fiddle with physics - hitting ramps at higher speed still often bugs, try to fiddle with physics
again (reshape iterations, tension, ...) again (reshape iterations, tension, ...)
- make car turned on its back behave nicer
- press forward map??? :-D only when physics is frozen - press forward map??? :-D only when physics is frozen
- make some kinda repo for world record runs? - make some kinda repo for world record runs?
- Try doing the bouncy car body? Just keep a point and its velocity, change - Try doing the bouncy car body? Just keep a point and its velocity, change
@ -34,6 +35,8 @@ fuck issue trackers :D
=========== BUGS ================= =========== BUGS =================
- at high resolution (like 1920) buggy triangles sometimes appeard, tried to
fix this in S3L now but needs to be tested
- immediately after starting the map countdown seems to be lower (seems to - immediately after starting the map countdown seems to be lower (seems to
perhaps be caused by nextPhysicsFrameTime, look into it) perhaps be caused by nextPhysicsFrameTime, look into it)

View file

@ -361,7 +361,6 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
if (pixel->modelIndex == 8) if (pixel->modelIndex == 8)
{ {
// car model // car model
LCR_loadImage(LCR_IMAGE_CAR); LCR_loadImage(LCR_IMAGE_CAR);

View file

@ -2,6 +2,9 @@
#define SMALL3DLIB_H #define SMALL3DLIB_H
/* /*
NOTE: This is a Licar specific fork of the library. Changes made can be
found e.g. with diff.
Simple realtime 3D software rasterization renderer. It is fast, focused on Simple realtime 3D software rasterization renderer. It is fast, focused on
resource-limited computers, located in a single C header file, with no resource-limited computers, located in a single C header file, with no
dependencies, using only 32bit integer arithmetics. dependencies, using only 32bit integer arithmetics.
@ -2016,6 +2019,25 @@ void S3L_drawTriangle(
p.triangleSize[1] = p.triangleSize[1] =
(rPointSS->y > lPointSS->y ? rPointSS->y : lPointSS->y) - tPointSS->y; (rPointSS->y > lPointSS->y ? rPointSS->y : lPointSS->y) - tPointSS->y;
// Licar modifications below: handle buggy triangles (still imperfect)
if (S3L_abs(p.triangleSize[0]) > (5 * S3L_RESOLUTION_X / 2) ||
S3L_abs(p.triangleSize[1]) > (5 * S3L_RESOLUTION_Y / 2))
return;
lPointSS->x = S3L_clamp(lPointSS->x,
-1 * S3L_RESOLUTION_X,2 * S3L_RESOLUTION_X);
rPointSS->x = S3L_clamp(rPointSS->x,
-1 * S3L_RESOLUTION_X,2 * S3L_RESOLUTION_X);
tPointSS->x = S3L_clamp(tPointSS->x,
-1 * S3L_RESOLUTION_X,2 * S3L_RESOLUTION_X);
lPointSS->y = S3L_clamp(lPointSS->y,
-1 * S3L_RESOLUTION_Y,2 * S3L_RESOLUTION_Y);
rPointSS->y = S3L_clamp(rPointSS->y,
-1 * S3L_RESOLUTION_Y,2 * S3L_RESOLUTION_Y);
tPointSS->y = S3L_clamp(tPointSS->y,
-1 * S3L_RESOLUTION_Y,2 * S3L_RESOLUTION_Y);
// now draw the triangle line by line: // now draw the triangle line by line:
S3L_ScreenCoord splitY; // Y of the vertically middle point of the triangle S3L_ScreenCoord splitY; // Y of the vertically middle point of the triangle