fx : Rendu réparé et début dscale_bopti

This commit is contained in:
attilavs2 2024-09-26 20:47:04 +02:00
parent 950a7b5631
commit 12df54420b
4 changed files with 41 additions and 5 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
# Build files
/build-fx
/build-fxg3a
/build-cg
/build-cg-push
/*.g1a

View file

@ -102,10 +102,14 @@ int main(){
goto c3d_abort;
dupdate();
dimage(0,0,tex_index[0]);
dclear(C_WHITE);
dscale_bopti(&briques0, fix(2), fix(2), 0, 0);
/*dimage(0,0,tex_index[0]);
dimage(32,0,tex_index[1]);
dimage(64,0,tex_index[2]);
dimage(96,0,tex_index[3]);
dimage(96,0,tex_index[3]);*/
dupdate();
getkey();

View file

@ -191,6 +191,33 @@ inline int __attribute__((always_inline))
uint32_t *light, *dark;
void dscale_bopti(bopti_image_t *tex, fixed_t scale_x, fixed_t scale_y, int x, int y){
fixed_t screen_x = x;
fixed_t screen_y = y;
for(fixed_t tex_y = 0; tex_y < fix(tex->height); tex_y+=scale_y){
yloop:
;//For clangd which doesn't like the label (?)
fixed_t oldy = screen_y;
screen_y += scale_y;
if(screen_y >= 64)
break;
for(; oldy < screen_x; oldy += 0xFFFF){
for(fixed_t tex_x = 0; tex_x < fix(tex->width); tex_x+=scale_x){
fixed_t oldx = screen_x;
screen_x += scale_x;
if(screen_x >= 128)
goto yloop;
int tpix = get_pixel(tex, tex_x, tex_y);
for(; oldx < screen_x; oldx += 0xFFFF){
dpixel(screen_x, screen_y, tpix);
}
screen_x = oldx;
}
}
screen_y = oldy;
}
}
inline void __attribute__((always_inline))
draw_stripe(bopti_image_t *tex, int texSampleY, int linePos, fixed_t texSize,
int texX, int x){
@ -203,7 +230,7 @@ inline void __attribute__((always_inline))
do{
if(screenPos >= fix(viewport_h))
return;
dpixel(x, fceil(screenPos), tpix);
dpixel(x, ffloor(oldPos), tpix);
oldPos += 0xFFFF;
} while(oldPos <= screenPos+texSize);
}

View file

@ -12,7 +12,7 @@
#define screen_h 64
#define viewport_w 128
#define viewport_h 64
#define max_dist fix(32) //en tuiles << 16, actuellement 32
#define max_dist fix(32)
#define TSIZE 32
@ -29,7 +29,11 @@ typedef struct {
} EngineTimers;
void draw_stripe(bopti_image_t *tex, int texSampleY, int linePos, fixed_t texSize, int texX, int x);
void dscale_bopti(bopti_image_t *tex, fixed_t scale_x, fixed_t scale_y,
int x, int y);
void draw_stripe(bopti_image_t *tex, int texSampleY, int linePos,
fixed_t texSize, int texX, int x);
void load_map();
void end_screen();