Add motion blur mod
This commit is contained in:
parent
c049e2f536
commit
b9aed6027e
1 changed files with 51 additions and 0 deletions
51
mods/motion_blur.diff
Normal file
51
mods/motion_blur.diff
Normal file
|
@ -0,0 +1,51 @@
|
|||
Simple dithered motion blur effect, applied to whole rendering.
|
||||
|
||||
diff --git a/game.h b/game.h
|
||||
index 1ad5131..d886e0b 100644
|
||||
--- a/game.h
|
||||
+++ b/game.h
|
||||
@@ -347,6 +347,8 @@ struct
|
||||
char popupStr[LCR_POPUP_STR_SIZE];
|
||||
uint8_t popupCountdown;
|
||||
|
||||
+ int_fast8_t frameCycle;
|
||||
+
|
||||
struct
|
||||
{
|
||||
uint8_t selectedTab;
|
||||
@@ -399,6 +401,9 @@ uint8_t LCR_gameMusicOn(void)
|
||||
|
||||
void LCR_gameDrawPixel(unsigned long index, uint16_t color)
|
||||
{
|
||||
+ if ((index % LCR_SETTING_MOTION_BLUR_FRAMES) != LCR_game.frameCycle)
|
||||
+ return;
|
||||
+
|
||||
#if LCR_SETTING_RESOLUTION_SUBDIVIDE <= 1
|
||||
LCR_drawPixel(index,color);
|
||||
#else
|
||||
@@ -1899,6 +1904,8 @@ uint8_t LCR_gameStep(uint32_t time)
|
||||
{
|
||||
LCR_LOG2("rendering next frame");
|
||||
|
||||
+ LCR_game.frameCycle = LCR_renderer.frame % LCR_SETTING_MOTION_BLUR_FRAMES;
|
||||
+
|
||||
while (time >= LCR_game.nextRenderFrameTime)
|
||||
LCR_game.nextRenderFrameTime += 1000 / LCR_SETTING_FPS;
|
||||
|
||||
diff --git a/settings.h b/settings.h
|
||||
index 332df45..4c28e70 100644
|
||||
--- a/settings.h
|
||||
+++ b/settings.h
|
||||
@@ -222,6 +222,12 @@
|
||||
#define LCR_SETTING_TIME_MULTIPLIER 100
|
||||
#endif
|
||||
|
||||
+#ifndef LCR_SETTING_MOTION_BLUR_FRAMES
|
||||
+ #define LCR_SETTING_MOTION_BLUR_FRAMES 2
|
||||
+ /** Length of the motion blur rendering cycle. The longer, the more pronounced
|
||||
+ the effect. Should be kept a power of two else performance suffers greatly. */
|
||||
+#endif
|
||||
+
|
||||
#ifndef LCR_SETTING_GHOST_STEP
|
||||
/** Step (in physics engine ticks) by which the samples for ghost car will be
|
||||
spaced (positions inbetween will be interpolated). Lower step along with more
|
Loading…
Add table
Add a link
Reference in a new issue