Tests sampling

This commit is contained in:
attilavs2 2023-08-20 15:45:57 +02:00
parent 7967d6f79b
commit d980f28fb7
3 changed files with 13 additions and 5 deletions

View file

@ -23,7 +23,7 @@ set(ASSETS
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA) fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}}) add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os) target_compile_options(myaddin PRIVATE -Wall -Wextra -Ofast)
target_link_libraries(myaddin Gint::Gint ) target_link_libraries(myaddin Gint::Gint )
target_link_libraries(myaddin LibProf::LibProf) target_link_libraries(myaddin LibProf::LibProf)
target_link_options(myaddin PRIVATE -Wl,--print-memory-usage) target_link_options(myaddin PRIVATE -Wl,--print-memory-usage)

View file

@ -43,7 +43,7 @@ void USB_capture() {
} }
#endif #endif
//#define debug //pour afficher les infos de debug #define debug //pour afficher les infos de debug
extern char map_test[map_w][map_h]; extern char map_test[map_w][map_h];

View file

@ -261,7 +261,11 @@ void draw_walls(image_t *tex_1, image_t *tex_2, image_t *tex_3, image_t *tex_4,
deltaDistY = abs(fdiv(0xFFFF, rayDirY)); deltaDistY = abs(fdiv(0xFFFF, rayDirY));
//calculate step and initial sideDist //calculate step and initial sideDist
if (rayDirX <= 0) { if (rayDirX == 0) {
stepX = 0;
sideDistX = 0;
}
else if (rayDirX < 0) {
stepX = -1; //true stepX = -1; //true
sideDistX = fmul(posX - fix(mapX), deltaDistX); sideDistX = fmul(posX - fix(mapX), deltaDistX);
} }
@ -270,7 +274,11 @@ void draw_walls(image_t *tex_1, image_t *tex_2, image_t *tex_3, image_t *tex_4,
sideDistX = fmul( fix(mapX + 1) - posX, deltaDistX); sideDistX = fmul( fix(mapX + 1) - posX, deltaDistX);
} }
if (rayDirY <= 0) { if (rayDirY == 0) {
stepY = 0;
sideDistY = 0;
}
else if (rayDirY < 0) {
stepY = -1; //true stepY = -1; //true
sideDistY = fmul(posY - fix(mapY), deltaDistY); sideDistY = fmul(posY - fix(mapY), deltaDistY);
} }
@ -338,7 +346,7 @@ void draw_walls(image_t *tex_1, image_t *tex_2, image_t *tex_3, image_t *tex_4,
if (texSize < 0x400) texSize = 0x400; //0x400 = 1/64 * 2^16 if (texSize < 0x400) texSize = 0x400; //0x400 = 1/64 * 2^16
if (texSize > 0x3D000) { //0x3D000 = 3.8125 * 2^16, 3.8125 = viewport_h/64 if (texSize > 0x3D000) { //0x3D000 = 3.8125 * 2^16, 3.8125 = viewport_h/64
texSample = ffloor(fdiv(fix(viewport_h), texSize)); texSample = ffloor(fdiv(fix(viewport_h), texSize));
texSampleY = 32 - (int)texSample * 0.5; texSampleY = 32 - (int)texSample * 0.5 + 1;
} }
else { else {
texSample = 64; texSample = 64;