Adjust block LODs a bit

This commit is contained in:
Miloslav Ciz 2024-08-29 15:38:44 +02:00
parent fde803bb18
commit 31d820b4b9
2 changed files with 27 additions and 11 deletions

View file

@ -12,6 +12,10 @@
#define LCR_FREE_CAMERA_STEP \ #define LCR_FREE_CAMERA_STEP \
(LCR_SETTING_FREE_CAMERA_SPEED / LCR_SETTING_FPS) (LCR_SETTING_FREE_CAMERA_SPEED / LCR_SETTING_FPS)
#if LCR_FREE_CAMERA_STEP == 0
#define LCR_FREE_CAMERA_STEP 1
#endif
#define LCR_FREE_CAMERA_TURN_STEP \ #define LCR_FREE_CAMERA_TURN_STEP \
(LCR_SETTING_FREE_CAMERA_TURN_SPEED / LCR_SETTING_FPS) (LCR_SETTING_FREE_CAMERA_TURN_SPEED / LCR_SETTING_FPS)

View file

@ -816,7 +816,7 @@ void LCR_rendererDrawRect(int x, int y, unsigned int w, unsigned int h,
} }
void _LCR_rendererDrawLODBlock(int blockX, int blockY, int blockZ, unsigned int size, void _LCR_rendererDrawLODBlock(int blockX, int blockY, int blockZ, unsigned int size,
uint16_t color) uint16_t color, uint8_t variability)
{ {
S3L_Vec4 p, r; S3L_Vec4 p, r;
@ -836,10 +836,23 @@ void _LCR_rendererDrawLODBlock(int blockX, int blockY, int blockZ, unsigned int
if (r.w > 0 && r.z > LCR_SETTING_LOD_DISTANCE * LCR_RENDERER_UNIT && if (r.w > 0 && r.z > LCR_SETTING_LOD_DISTANCE * LCR_RENDERER_UNIT &&
r.w < LCR_EFFECTIVE_RESOLUTION_X) r.w < LCR_EFFECTIVE_RESOLUTION_X)
{ {
LCR_rendererDrawRect(r.x - r.w / 2,r.y - r.w / 2,(5 * r.w) / 8, switch (variability % 4)
(5 * r.w) / 8,color,1); {
LCR_rendererDrawRect(r.x - r.w / 4,r.y, case 0: r.w += r.w / 4; r.x += LCR_BLOCK_SIZE / 8; break;
(3 * r.w) / 4,r.w / 2,color,1); case 1: r.w += r.w / 8; r.y -= LCR_BLOCK_SIZE / 16; break;
case 2: r.w += r.w / 4; break;
default: r.z += LCR_BLOCK_SIZE / 8; break;
}
if (variability % 8 < 5)
LCR_rendererDrawRect(r.x - r.w / 2,r.y - r.w / 2,r.w,r.w,color,1);
else
{
r.w /= 2;
LCR_rendererDrawRect(r.x - r.w / 2,r.y - r.w / 2,r.w,r.w,color,1);
r.w += r.w / 2;
LCR_rendererDrawRect(r.x - r.w / 8,r.y - r.w / 4,r.w,r.w,color,1);
}
} }
} }
@ -1051,6 +1064,8 @@ void _LCR_rendererLoadMapChunks(void)
void LCR_rendererDrawLOD(void) void LCR_rendererDrawLOD(void)
{ {
#if LCR_SETTING_LOD_DISTANCE < 64 #if LCR_SETTING_LOD_DISTANCE < 64
int variability = 0;
for (unsigned int i = 0; i < LCR_RENDERER_LOD_BLOCKS; ++i) for (unsigned int i = 0; i < LCR_RENDERER_LOD_BLOCKS; ++i)
if (LCR_renderer.gridOfLODs[i]) if (LCR_renderer.gridOfLODs[i])
{ {
@ -1060,18 +1075,15 @@ void LCR_rendererDrawLOD(void)
bz = (i / 8) * 8 + 4; bz = (i / 8) * 8 + 4;
by = (i % 8) * 8 + 4; by = (i % 8) * 8 + 4;
int var = 0;
for (unsigned int j = 0; j < 8; ++j) for (unsigned int j = 0; j < 8; ++j)
{ {
if (byte & 0x01) if (byte & 0x01)
{ {
var = var < 2 ? var + 1 : 0; variability = variability < 14 ? variability + 1 : 0;
bx = j * 8 + 4; bx = j * 8 + 4;
_LCR_rendererDrawLODBlock(bx,by,bz, _LCR_rendererDrawLODBlock(bx,by,bz,(4 * LCR_EFFECTIVE_RESOLUTION_Y)
(LCR_EFFECTIVE_RESOLUTION_X * (2 + var)) / 2, / 3,LCR_SETTING_LOD_COLOR,variability);
LCR_SETTING_LOD_COLOR | (0x4108 >> var));
} }
byte >>= 1; byte >>= 1;