From 1763cc34548b341e356049b5d01a9e69bd87a74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Thu, 20 Jun 2019 15:43:19 +0200 Subject: [PATCH] Start camera control (city) --- programs/city.c | 7 +++++-- todo.txt | 3 --- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/programs/city.c b/programs/city.c index 65fad09..79240e3 100644 --- a/programs/city.c +++ b/programs/city.c @@ -318,11 +318,14 @@ int main() else velocity = S3L_min(0,velocity + stepFriction * friction); + S3L_Unit cameraDistance = + S3L_FRACTIONS_PER_UNIT / 2 + (S3L_abs(velocity) * (S3L_FRACTIONS_PER_UNIT / 2) / MAX_VELOCITY); + scene.camera.transform.translation.x = - scene.models[1].transform.translation.x - carDirection.x; + scene.models[1].transform.translation.x - (carDirection.x * cameraDistance) / S3L_FRACTIONS_PER_UNIT; scene.camera.transform.translation.z = - scene.models[1].transform.translation.z - carDirection.z; + scene.models[1].transform.translation.z - (carDirection.z * cameraDistance) / S3L_FRACTIONS_PER_UNIT; scene.camera.transform.rotation.y = models[1].transform.rotation.y; diff --git a/todo.txt b/todo.txt index c4faaf5..5b1fd9d 100644 --- a/todo.txt +++ b/todo.txt @@ -27,9 +27,6 @@ features: interpolation -- it will randomly picky one of three values, with greater probabilities at greater coords -- change the default backface culling to the other one (and edit the obj tool - accordingly) - - option to disable baycentric coordinates computing DONE - Z-buffer: