Continue checkpoint rendering

This commit is contained in:
Miloslav Ciz 2024-10-07 22:07:58 +02:00
parent 2c5162b635
commit ac5bddd9f4
5 changed files with 33 additions and 33 deletions

View file

@ -35,7 +35,7 @@
=========== BUGS ================= =========== BUGS =================
- drawing dithered transparent objects fills z-buffer in the transparent parts - drawing dithered transparent objects fills z-buffer in the transparent parts
and then the geometry behind it isn't drawn and then the geometry behind it isn't drawn <- PARTIALLY FIXED NOW
=========== HANDLED ============== =========== HANDLED ==============

View file

@ -61,6 +61,7 @@ LCR_MAP_BLOCK(LCR_BLOCK_RAMP_CURVED_PLAT,4,5,6,LCR_BLOCK_MATERIAL_CONCRETE,LCR_B
LCR_MAP_BLOCK(LCR_BLOCK_RAMP_CURVED_PLAT,3,5,6,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_FLIP_V | LCR_BLOCK_TRANSFORM_ROT_180), LCR_MAP_BLOCK(LCR_BLOCK_RAMP_CURVED_PLAT,3,5,6,LCR_BLOCK_MATERIAL_CONCRETE,LCR_BLOCK_TRANSFORM_FLIP_V | LCR_BLOCK_TRANSFORM_ROT_180),
LCR_MAP_BLOCK(LCR_BLOCK_CHECKPOINT_0,3,2,4,LCR_BLOCK_MATERIAL_CONCRETE,0), LCR_MAP_BLOCK(LCR_BLOCK_CHECKPOINT_0,3,2,4,LCR_BLOCK_MATERIAL_CONCRETE,0),
LCR_MAP_BLOCK(LCR_BLOCK_FINISH,3,2,2,LCR_BLOCK_MATERIAL_CONCRETE,0),
/* /*
LCR_MAP_BLOCK(LCR_BLOCK_FULL,2,1,9,LCR_BLOCK_MATERIAL_CONCRETE,0), LCR_MAP_BLOCK(LCR_BLOCK_FULL,2,1,9,LCR_BLOCK_MATERIAL_CONCRETE,0),

25
map.h
View file

@ -516,19 +516,18 @@ void LCR_mapGetBlockShape(uint8_t blockType, uint8_t transform,
switch (blockType) switch (blockType)
{ {
case LCR_BLOCK_CHECKPOINT_0:
case LCR_BLOCK_CHECKPOINT_0: case LCR_BLOCK_CHECKPOINT_1:
case LCR_BLOCK_CHECKPOINT_1: case LCR_BLOCK_FINISH:
ADD(3,0,3) ADD(6,2,0) ADD(0,2,0) ADD(3,0,3) ADD(0,2,6) ADD(6,2,6)
ADD(3,0,3) ADD(6,2,6) ADD(6,2,0) ADD(3,0,3) ADD(0,2,0) ADD(0,2,6)
ADD(3,0,3) ADD(0,2,0) ADD(0,2,6) ADD(3,0,3) ADD(6,2,0) ADD(0,2,0)
ADD(3,0,3) ADD(0,2,6) ADD(6,2,6) ADD(3,0,3) ADD(6,2,6) ADD(6,2,0)
ADD(3,4,3) ADD(0,2,0) ADD(6,2,0) ADD(3,4,3) ADD(0,2,6) ADD(0,2,0)
ADD(3,4,3) ADD(6,2,0) ADD(6,2,6) ADD(3,4,3) ADD(0,2,0) ADD(6,2,0)
ADD(3,4,3) ADD(0,2,6) ADD(0,2,0) ADD(3,4,3) ADD(6,2,0) ADD(6,2,6)
ADD(3,4,3) ADD(6,2,6) ADD(0,2,6) ADD(3,4,3) ADD(6,2,6) ADD(0,2,6)
break; break;
case LCR_BLOCK_FULL: case LCR_BLOCK_FULL:
case LCR_BLOCK_BOTTOM: case LCR_BLOCK_BOTTOM:

View file

@ -35,17 +35,10 @@
kinda hotfixes it -- later try to discover source of this bug. TODO */ kinda hotfixes it -- later try to discover source of this bug. TODO */
#define _LCR_MAP_MODEL_SCALE 1034 #define _LCR_MAP_MODEL_SCALE 1034
#define LCR_RENDERER_MAT_CP0 0x0f ///< material for untaken checkpoint
#define LCR_RENDERER_MAT_CP0 0x0f
#define LCR_RENDERER_MAT_CP1 0x0e #define LCR_RENDERER_MAT_CP1 0x0e
#define LCR_RENDERER_MAT_FIN 0x0d #define LCR_RENDERER_MAT_FIN 0x0d
struct struct
{ {
S3L_Scene scene; S3L_Scene scene;
@ -170,16 +163,18 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
switch (mat) switch (mat)
{ {
#define CL (type ? 0x8210 : 0x0000)
case LCR_RENDERER_MAT_CP0: case LCR_RENDERER_MAT_CP0:
LCR_renderer.flatAndTransparent = LCR_SETTING_CHECKPOINT0_COLOR; LCR_renderer.flatAndTransparent = LCR_SETTING_CHECKPOINT_0_COLOR | CL;
break; break;
case LCR_RENDERER_MAT_CP1: case LCR_RENDERER_MAT_CP1:
LCR_renderer.flatAndTransparent = LCR_SETTING_CHECKPOINT1_COLOR; LCR_renderer.flatAndTransparent = LCR_SETTING_CHECKPOINT_1_COLOR | CL;
break; break;
case LCR_RENDERER_MAT_FIN: case LCR_RENDERER_MAT_FIN:
LCR_renderer.flatAndTransparent = LCR_SETTING_FINISH_COLOR; LCR_renderer.flatAndTransparent = LCR_SETTING_FINISH_COLOR | CL;
#undef CL
break; break;
default: default:
@ -234,7 +229,6 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
} }
break; break;
} }
} }
} }
@ -242,6 +236,12 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
{ {
if (pixel->x % 2 == pixel->y % 2) if (pixel->x % 2 == pixel->y % 2)
LCR_drawPixelXYUnsafe(pixel->x,pixel->y,LCR_renderer.flatAndTransparent); LCR_drawPixelXYUnsafe(pixel->x,pixel->y,LCR_renderer.flatAndTransparent);
else
S3L_zBufferWrite(pixel->x,pixel->y,S3L_MAX_DEPTH);
/* ^ Clear z-buffer if we don't draw the pixel. Without this further
geometry drawn later on won't be seen through transparent objects which
looks bad. With this "fix" glitches may still appear (wrong draw order)
but it generally looks better this way. */
return; return;
} }
@ -712,9 +712,9 @@ uint8_t _LCR_buildMapModel(void)
uint8_t triData; uint8_t triData;
if (blockType == LCR_BLOCK_CHECKPOINT_0) if (blockType == LCR_BLOCK_CHECKPOINT_0)
triData = LCR_RENDERER_MAT_CP0; triData = LCR_RENDERER_MAT_CP0 | ((i % 2) << 4);
else if (blockType == LCR_BLOCK_FINISH) else if (blockType == LCR_BLOCK_FINISH)
triData = LCR_RENDERER_MAT_FIN; triData = LCR_RENDERER_MAT_FIN | ((i % 2) << 4);
else else
{ {
uint8_t blockMat = LCR_mapBlockGetMaterial(block); uint8_t blockMat = LCR_mapBlockGetMaterial(block);

View file

@ -126,19 +126,19 @@
#define LCR_SETTING_GHOST_COLOR 0xff00 #define LCR_SETTING_GHOST_COLOR 0xff00
#endif #endif
#ifndef LCR_SETTING_CHECKPOINT0_COLOR #ifndef LCR_SETTING_CHECKPOINT_0_COLOR
/** Color of untaken checkpoint (in RGB565). */ /** Color of untaken checkpoint (in RGB565). */
#define LCR_SETTING_CHECKPOINT0_COLOR 0x0f00 #define LCR_SETTING_CHECKPOINT_0_COLOR 0x37e0
#endif #endif
#ifndef LCR_SETTING_CHECKPOINT1_COLOR #ifndef LCR_SETTING_CHECKPOINT_1_COLOR
/** Color of taken checkpoint (in RGB565). */ /** Color of taken checkpoint (in RGB565). */
#define LCR_SETTING_CHECKPOINT1_COLOR 0xf000 #define LCR_SETTING_CHECKPOINT_1_COLOR 0xdefb
#endif #endif
#ifndef LCR_SETTING_FINISH_COLOR #ifndef LCR_SETTING_FINISH_COLOR
/** Color of finish block (in RGB565). */ /** Color of finish block (in RGB565). */
#define LCR_SETTING_FINISH_COLOR 0x00f0 #define LCR_SETTING_FINISH_COLOR 0xf900
#endif #endif
#ifndef LCR_SETTING_SMOOTH_ANIMATIONS #ifndef LCR_SETTING_SMOOTH_ANIMATIONS