mirror of
https://git.planet-casio.com/Fcalva/Copy3DEngine.git
synced 2025-06-06 15:35:03 +02:00
Optimisations :E
Écriture directe en VRAM et -O3, pour 20 fps
This commit is contained in:
parent
d980f28fb7
commit
08ba5ff335
4 changed files with 16 additions and 18 deletions
|
@ -23,7 +23,7 @@ set(ASSETS
|
|||
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
|
||||
|
||||
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
|
||||
target_compile_options(myaddin PRIVATE -Wall -Wextra -Ofast)
|
||||
target_compile_options(myaddin PRIVATE -Wall -Wextra -O3 -fira-region=all )
|
||||
target_link_libraries(myaddin Gint::Gint )
|
||||
target_link_libraries(myaddin LibProf::LibProf)
|
||||
target_link_options(myaddin PRIVATE -Wl,--print-memory-usage)
|
||||
|
|
BIN
src/.main.c.swp
Normal file
BIN
src/.main.c.swp
Normal file
Binary file not shown.
15
src/main.c
15
src/main.c
|
@ -19,7 +19,7 @@
|
|||
#include "map_test.h"
|
||||
|
||||
//====== Maze3D V0.2 =====
|
||||
// Git du moteur : https://github.com/attilavs2/Raycaster_prealpha
|
||||
// Git du moteur : https://github.com/attilavs2/Raycaster_G90
|
||||
// Git du jeu : https://gitea.planet-casio.com/Fcalva/Maze3D
|
||||
//
|
||||
// Page du jeu : https://www.planet-casio.com/Fr/programmes/programme4355-1-maze3d-fcalva-jeux-reflexion.html
|
||||
|
@ -43,7 +43,7 @@ void USB_capture() {
|
|||
}
|
||||
#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];
|
||||
|
||||
|
@ -110,7 +110,7 @@ int main(){
|
|||
|
||||
load_map();
|
||||
|
||||
image_t frame_buffer = *image_alloc(viewport_w, viewport_h, IMAGE_RGB565A);
|
||||
image_t *frame_buffer = image_create_vram();
|
||||
|
||||
image_t sky_tex = *image_alloc(64, 64, IMAGE_RGB565);
|
||||
image_t WXOR_tex = *image_alloc(64, 64, IMAGE_RGB565);
|
||||
|
@ -141,11 +141,9 @@ int main(){
|
|||
drect(0, 0, 395, 112, 0x9dbd);
|
||||
drect(0,112, 395, 243, 0xc4c9);
|
||||
|
||||
image_clear(&frame_buffer);
|
||||
image_clear(frame_buffer);
|
||||
|
||||
draw_walls(&buisson0, &briques0, &sky_tex, &WXOR_tex, &D_tex, &frame_buffer);
|
||||
|
||||
dimage(0, 0, &frame_buffer);
|
||||
draw_walls(&buisson0, &briques0, &sky_tex, &WXOR_tex, &D_tex, frame_buffer);
|
||||
|
||||
if(first_frame == 1) main_menu();
|
||||
|
||||
|
@ -171,12 +169,13 @@ int main(){
|
|||
}
|
||||
|
||||
prof_quit();
|
||||
#ifdef USB
|
||||
usb_close();
|
||||
#endif
|
||||
|
||||
free(&sky_tex);
|
||||
free(&WXOR_tex);
|
||||
free(&D_tex);
|
||||
free(&frame_buffer);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ void draw_walls(image_t *tex_1, image_t *tex_2, image_t *tex_3, image_t *tex_4,
|
|||
fixed_t texSize = fix(lineHeight) / 64; //taille proportionelle de la ligne a la tex
|
||||
if (texSize < 0x400) texSize = 0x400; //0x400 = 1/64 * 2^16
|
||||
if (texSize > 0x3D000) { //0x3D000 = 3.8125 * 2^16, 3.8125 = viewport_h/64
|
||||
texSample = ffloor(fdiv(fix(viewport_h), texSize));
|
||||
texSample = fceil(fdiv(fix(viewport_h), texSize));
|
||||
texSampleY = 32 - (int)texSample * 0.5 + 1;
|
||||
}
|
||||
else {
|
||||
|
@ -353,6 +353,7 @@ void draw_walls(image_t *tex_1, image_t *tex_2, image_t *tex_3, image_t *tex_4,
|
|||
texSampleY = 0;
|
||||
}
|
||||
|
||||
|
||||
image_t texStripe;
|
||||
image_clear(&texStripe);
|
||||
|
||||
|
@ -365,8 +366,6 @@ void draw_walls(image_t *tex_1, image_t *tex_2, image_t *tex_3, image_t *tex_4,
|
|||
}
|
||||
|
||||
image_scale(&texStripe, 0xFFFF, texSize, &temp);
|
||||
temp.src_stride = 1;
|
||||
temp.dst_stride = 1;
|
||||
image_linear(&texStripe, image_at(frame_buffer, x, (int)(viewport_h * 0.5 - lineHeight * 0.5) + v_offset), &temp);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue