Add fog
This commit is contained in:
parent
cfe2f711de
commit
71a034d74c
3 changed files with 34 additions and 12 deletions
11
TODO.txt
11
TODO.txt
|
@ -2,6 +2,7 @@ fuck issue trackers :D
|
|||
|
||||
=========== GENERAL ==============
|
||||
|
||||
- press forward map??? :-D
|
||||
- make some kinda repo for world record runs?
|
||||
- fix the ramp map again due to new physics -- NOW it's almost good but it's
|
||||
still possible to reach the finish at first jump, try to do something about it
|
||||
|
@ -14,7 +15,6 @@ fuck issue trackers :D
|
|||
its velocity by a proportion of car's velocity change (this minus prev.
|
||||
frame), then offset car body by this. However we'll also have to transform
|
||||
inbetween world space and model space.
|
||||
- try to add distance fog?
|
||||
- c99 may impose limit 4095 chars on str literal, gives warning on internal
|
||||
data file, try to somehow hack around it (maybe just convert it to an array in
|
||||
the end?) Maybe this: make a standalone C file with the string in it that
|
||||
|
@ -39,16 +39,17 @@ fuck issue trackers :D
|
|||
|
||||
=========== BUGS =================
|
||||
|
||||
- After adding the non-rotating physics feature, the car now gets funny when
|
||||
turned on the roof, once even shot to the ceiling of the map.
|
||||
- Managed to get the car stuck in non-rotating state, then after a while get
|
||||
it back by crashing. MAY BE FIXED NOW, watch if it still happens
|
||||
- immediately after starting the map countdown seems to be lower (seems to
|
||||
perhaps be caused by nextPhysicsFrameTime, look into it)
|
||||
|
||||
=========== HANDLED ==============
|
||||
|
||||
- should drifting make a sound? NO NEED
|
||||
- Managed to get the car stuck in non-rotating state, then after a while get
|
||||
it back by crashing. MAY BE FIXED NOW, watch if it still happens
|
||||
- After adding the non-rotating physics feature, the car now gets funny when
|
||||
turned on the roof, once even shot to the ceiling of the map.
|
||||
- try to add distance fog?
|
||||
- Consider better input handling in SDL? Currently it just detects presses on
|
||||
the exact frame, so a press can be missed. But how tho? LOOKS FINE, it's
|
||||
only an issue with extremely low FPS, at which point it's unplayable anyway
|
||||
|
|
30
renderer.h
30
renderer.h
|
@ -36,6 +36,7 @@
|
|||
#define LCR_ANIMATE_CAR (LCR_SETTING_CAR_ANIMATION_SUBDIVIDE != 0)
|
||||
|
||||
#if LCR_SETTING_POTATO_GRAPHICS
|
||||
#undef S3L_PERSPECTIVE_CORRECTION
|
||||
#define S3L_PERSPECTIVE_CORRECTION 0
|
||||
#define S3L_NEAR_CROSS_STRATEGY 1
|
||||
#define S3L_FLAT 1
|
||||
|
@ -84,6 +85,9 @@ struct
|
|||
*/
|
||||
S3L_Model3D models[LCR_RENDERER_MODEL_COUNT];
|
||||
|
||||
uint_fast16_t pixelColor; /**< Holds pixel color for _LCR_pixelFunc3D. This
|
||||
is needed is texture subsampling is on. */
|
||||
|
||||
uint32_t frame;
|
||||
uint8_t loadedChunks[8]; ///< Numbers of loaded map chunks.
|
||||
|
||||
|
@ -278,9 +282,6 @@ int _LCR_rendererQuadLooksConvex(S3L_Unit quad[8])
|
|||
return 1;
|
||||
}
|
||||
|
||||
uint16_t _LCR_pixelColor = 0; /**< Holds pixel color for _LCR_pixelFunc3D. This
|
||||
is needed is texture subsampling is on. */
|
||||
|
||||
/**
|
||||
Used as a fragment shader by small3dlib. This function will be called for
|
||||
every rasterized 3D pixel, we use it write actual pixels to the screen with
|
||||
|
@ -362,6 +363,7 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
|
|||
}
|
||||
else if (pixel->modelIndex == 8)
|
||||
{
|
||||
|
||||
// car model
|
||||
LCR_loadImage(LCR_IMAGE_CAR);
|
||||
|
||||
|
@ -464,6 +466,11 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
|
|||
}
|
||||
}
|
||||
|
||||
#if LCR_SETTING_FOG
|
||||
if (pixel->depth > (S3L_MAX_DEPTH >> 18))
|
||||
LCR_imageChangeBrightness(0);
|
||||
#endif
|
||||
|
||||
// shift the UVs to the origin (prevent high values of UV coords)
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
|
@ -518,7 +525,7 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
|
|||
barycentric[1] = pixel->barycentric[1] / 8;
|
||||
barycentric[2] = pixel->barycentric[2] / 8;
|
||||
|
||||
_LCR_pixelColor = LCR_sampleImage(
|
||||
LCR_renderer.pixelColor = LCR_sampleImage(
|
||||
(barycentric[0] * LCR_renderer.triUVs[0] +
|
||||
barycentric[1] * LCR_renderer.triUVs[2] +
|
||||
barycentric[2] * LCR_renderer.triUVs[4])
|
||||
|
@ -535,7 +542,16 @@ void _LCR_pixelFunc3D(S3L_PixelInfo *pixel)
|
|||
LCR_renderer.texSubsampleCount--;
|
||||
#endif
|
||||
|
||||
LCR_gameDrawPixelXYUnsafe(pixel->x,pixel->y,_LCR_pixelColor);
|
||||
LCR_gameDrawPixelXYUnsafe(pixel->x,pixel->y,
|
||||
#if LCR_SETTING_FOG
|
||||
(((uint_fast16_t) 0) - (
|
||||
(pixel->depth < (S3L_MAX_DEPTH >> 20)) |
|
||||
((pixel->depth < (S3L_MAX_DEPTH >> 19)) &
|
||||
((pixel->x | pixel->y) % 2)) |
|
||||
((pixel->x ^ pixel->y) % 2))) &
|
||||
#endif
|
||||
LCR_renderer.pixelColor);
|
||||
|
||||
#endif // LCR_SETTING_POTATO_GRAPHICS
|
||||
}
|
||||
|
||||
|
@ -1210,8 +1226,6 @@ uint8_t LCR_rendererInit(void)
|
|||
LCR_renderer.ghostModel->transform.scale =
|
||||
LCR_renderer.carModel->transform.scale;
|
||||
|
||||
LCR_renderer.ghostModel->transform.translation.x -= LCR_GAME_UNIT / 4; // why is this here? TODO
|
||||
|
||||
#if LCR_ANIMATE_CAR
|
||||
for (int i = 0; i < LCR_CAR_VERTEX_COUNT * 3; ++i)
|
||||
LCR_renderer.animatedCarVerts[i] = LCR_carVertices[i];
|
||||
|
@ -1894,7 +1908,9 @@ void LCR_rendererDrawMenu(const char *tabName,const char **items,
|
|||
int stripHeight = (2 * LCR_EFFECTIVE_RESOLUTION_Y) / 7;
|
||||
int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 9;
|
||||
int i = 0;
|
||||
#if !(LCR_SETTING_POTATO_GRAPHICS || LCR_SETTING_332_COLOR)
|
||||
uint16_t effect = LCR_renderer.frame >> 1;
|
||||
#endif
|
||||
|
||||
LCR_LOG2("drawing menu");
|
||||
|
||||
|
|
|
@ -273,6 +273,11 @@
|
|||
#define LCR_SETTING_PARTICLE_COLOR_DIRT 0x8b84
|
||||
#endif
|
||||
|
||||
#ifndef LCR_SETTING_FOG
|
||||
/** Turns distance fog on/off. Turning this off may increase performance. */
|
||||
#define LCR_SETTING_FOG 0
|
||||
#endif
|
||||
|
||||
#ifndef LCR_SETTING_ONLY_SMALL_MAPS
|
||||
/** Turning this on will only include the small maps in the internal data
|
||||
file. This option exists for weak devices that couldn't handle big maps
|
||||
|
|
Loading…
Reference in a new issue