Fix small bugs
This commit is contained in:
parent
ab8bcd4605
commit
cbc67ae388
2 changed files with 32 additions and 9 deletions
2
TODO.txt
2
TODO.txt
|
@ -42,6 +42,8 @@ fuck issue trackers :D
|
|||
=========== HANDLED ==============
|
||||
|
||||
- should drifting make a sound? NO NEED
|
||||
- devtest map, internal camera: reversing at start makes the car face completely
|
||||
downwards which bugs the camera rotation! the shadow model too
|
||||
- particles in free camera mode are very big if far away from the car (maybe
|
||||
just turn them off in this mode?)
|
||||
- make helper header for PC frontends that use stdio for data file, parse
|
||||
|
|
39
renderer.h
39
renderer.h
|
@ -207,6 +207,14 @@ void _LCR_rendererDrawFontPixel(int x, int y, uint16_t color)
|
|||
#endif
|
||||
}
|
||||
|
||||
int _LCR_rendererGimbalDanger(S3L_Unit angle)
|
||||
{
|
||||
return S3L_min(
|
||||
S3L_abs(LCR_renderer.carModel->transform.rotation.x - S3L_F / 4),
|
||||
S3L_abs(LCR_renderer.carModel->transform.rotation.x - (S3L_F - S3L_F / 4)))
|
||||
< S3L_F / 100;
|
||||
}
|
||||
|
||||
int LCR_rendererComputeTextWidth(const char *text, int size)
|
||||
{
|
||||
int r = 0;
|
||||
|
@ -1843,15 +1851,22 @@ void LCR_rendererCameraFollow(unsigned char distance)
|
|||
|
||||
LCR_renderer.scene.camera.transform.translation.y += LCR_RENDERER_UNIT / 3;
|
||||
|
||||
LCR_renderer.scene.camera.transform.rotation =
|
||||
LCR_renderer.carModel->transform.rotation;
|
||||
if (!_LCR_rendererGimbalDanger( // kind of (imperfectly) deals with bugs
|
||||
LCR_renderer.carModel->transform.rotation.x))
|
||||
{
|
||||
LCR_renderer.scene.camera.transform.rotation =
|
||||
LCR_renderer.carModel->transform.rotation;
|
||||
|
||||
LCR_renderer.scene.camera.transform.rotation.x = -1 *
|
||||
((LCR_renderer.scene.camera.transform.rotation.x + S3L_FRACTIONS_PER_UNIT / 4) %
|
||||
(S3L_FRACTIONS_PER_UNIT / 2) - S3L_FRACTIONS_PER_UNIT / 4);
|
||||
LCR_renderer.scene.camera.transform.rotation.x = -1 *
|
||||
((LCR_renderer.scene.camera.transform.rotation.x +
|
||||
S3L_FRACTIONS_PER_UNIT / 4) % (S3L_FRACTIONS_PER_UNIT / 2) -
|
||||
S3L_FRACTIONS_PER_UNIT / 4);
|
||||
|
||||
LCR_renderer.scene.camera.transform.rotation.y += S3L_FRACTIONS_PER_UNIT / 2;
|
||||
LCR_renderer.scene.camera.transform.rotation.z *= -1;
|
||||
LCR_renderer.scene.camera.transform.rotation.y +=
|
||||
S3L_FRACTIONS_PER_UNIT / 2;
|
||||
|
||||
LCR_renderer.scene.camera.transform.rotation.z *= -1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -2130,8 +2145,9 @@ void LCR_rendererDraw3D(void)
|
|||
LCR_RENDERER_UNIT,LCR_RENDERER_UNIT,LCR_RENDERER_UNIT,
|
||||
LCR_RENDERER_UNIT);
|
||||
|
||||
LCR_renderer.shadowModel->transform.rotation.y =
|
||||
LCR_renderer.carModel->transform.rotation.y;
|
||||
if (!_LCR_rendererGimbalDanger(LCR_renderer.carModel->transform.rotation.x))
|
||||
LCR_renderer.shadowModel->transform.rotation.y =
|
||||
LCR_renderer.carModel->transform.rotation.y;
|
||||
#endif
|
||||
|
||||
// first make sure rotations are in correct range:
|
||||
|
@ -2182,6 +2198,11 @@ void LCR_rendererDraw3D(void)
|
|||
m = LCR_renderer.ghostModel;
|
||||
}
|
||||
|
||||
#if LCR_SETTING_CAR_SHADOW
|
||||
LCR_renderer.shadowModel->config.visible =
|
||||
LCR_renderer.carModel->config.visible;
|
||||
#endif
|
||||
|
||||
LCR_LOG2("3D rendering (start)");
|
||||
|
||||
#if LCR_SETTING_POTATO_GRAPHICS
|
||||
|
|
Loading…
Reference in a new issue