mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-11-25 10:22:23 -05:00
Add subsampling
This commit is contained in:
parent
78c3b2e2b4
commit
f971f1d423
13
main.c
13
main.c
@ -161,11 +161,18 @@ void SFG_pixelFunc(RCL_PixelInfo *pixel)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
color = SFG_getTexel(SFG_backgrounds[0],
|
color = SFG_getTexel(SFG_backgrounds[0],
|
||||||
SFG_backgroundScaleMap[(pixel->position.x + SFG_backgroundScroll) % SFG_RESOLUTION_Y],
|
SFG_backgroundScaleMap[(pixel->position.x * SFG_RAYCASTING_SUBSAMPLE + SFG_backgroundScroll) % SFG_RESOLUTION_Y],
|
||||||
|
// ^ TODO: get rid of mod?
|
||||||
SFG_backgroundScaleMap[pixel->position.y]);
|
SFG_backgroundScaleMap[pixel->position.y]);
|
||||||
}
|
}
|
||||||
|
|
||||||
SFG_setPixel(pixel->position.x,pixel->position.y,color);
|
RCL_Unit screenX = pixel->position.x * SFG_RAYCASTING_SUBSAMPLE;
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < SFG_RAYCASTING_SUBSAMPLE; ++i)
|
||||||
|
{
|
||||||
|
SFG_setPixel(screenX,pixel->position.y,color);
|
||||||
|
screenX++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RCL_Unit SFG_texturesAt(int16_t x, int16_t y)
|
RCL_Unit SFG_texturesAt(int16_t x, int16_t y)
|
||||||
@ -273,7 +280,7 @@ void SFG_init()
|
|||||||
RCL_initCamera(&SFG_camera);
|
RCL_initCamera(&SFG_camera);
|
||||||
RCL_initRayConstraints(&SFG_rayConstraints);
|
RCL_initRayConstraints(&SFG_rayConstraints);
|
||||||
|
|
||||||
SFG_camera.resolution.x = SFG_RESOLUTION_X;
|
SFG_camera.resolution.x = SFG_RESOLUTION_X / SFG_RAYCASTING_SUBSAMPLE;
|
||||||
SFG_camera.resolution.y = SFG_RESOLUTION_Y;
|
SFG_camera.resolution.y = SFG_RESOLUTION_Y;
|
||||||
SFG_camera.height = RCL_UNITS_PER_SQUARE;
|
SFG_camera.height = RCL_UNITS_PER_SQUARE;
|
||||||
SFG_camera.position.x = RCL_UNITS_PER_SQUARE * 5;
|
SFG_camera.position.x = RCL_UNITS_PER_SQUARE * 5;
|
||||||
|
19
settings.h
19
settings.h
@ -5,10 +5,29 @@
|
|||||||
#define SFG_RESOLUTION_X 1024
|
#define SFG_RESOLUTION_X 1024
|
||||||
#define SFG_RESOLUTION_Y 768
|
#define SFG_RESOLUTION_Y 768
|
||||||
|
|
||||||
|
/**
|
||||||
|
Whether shadows (fog) should be dithered, i.e. more smooth (needs a bit more
|
||||||
|
performance).
|
||||||
|
*/
|
||||||
#define SFG_DITHERED_SHADOW 1
|
#define SFG_DITHERED_SHADOW 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
Maximum number of squares that will be traversed by any cast ray. Smaller
|
||||||
|
number is faster but can cause visual artifacts.
|
||||||
|
*/
|
||||||
#define SFG_RAYCASTING_MAX_STEPS 30
|
#define SFG_RAYCASTING_MAX_STEPS 30
|
||||||
|
|
||||||
|
/**
|
||||||
|
Maximum number of hits any cast ray will register. Smaller number is faster
|
||||||
|
but can cause visual artifacts.
|
||||||
|
*/
|
||||||
#define SFG_RAYCASTING_MAX_HITS 10
|
#define SFG_RAYCASTING_MAX_HITS 10
|
||||||
|
|
||||||
|
/**
|
||||||
|
How many times rendering should be subsampled horizontally. Bigger number
|
||||||
|
can significantly improve performance (by casting fewer rays), but can look
|
||||||
|
a little worse.
|
||||||
|
*/
|
||||||
|
#define SFG_RAYCASTING_SUBSAMPLE 1
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
Loading…
Reference in New Issue
Block a user