This commit is contained in:
InventorXtreme 2023-12-04 00:00:12 -05:00
parent 2ff6576142
commit 0862f6ddcb

31
c3d.c
View file

@ -16,7 +16,7 @@ const float WIDTHSCALE = (float)RENDERWIDTH / SCREENWIDTH;
const float HEIGHTSCALE = (float) RENDERHEIGHT / SCREENHEIGHT;
const float fov = 90.0 / 180.0 * 3.14159265369;
const float fov = 70.0 / 180.0 * 3.14159265369;
const float half_fov = fov / 2;
float proj; //HALFWIDTH / tan(half_fov) Inited later
@ -93,11 +93,40 @@ void CtrlLocalCam(LocalCam *cam, float time) {
//cam->velocity.z = cam->velocity.z + 50000*time*sin(cam->angles.y);
//cam->velocity.x = cam->velocity.x + 500*time*cos(cam->angles.y);
}
if (IsKeyDown(KEY_S)) {
Vector3 forceForward = (Vector3){0,0,-500};
Vector3 rotatedforce = RotateAboutY(forceForward,cam->angles.y);
cam->velocity = Vector3Sum(cam->velocity,rotatedforce);
//cam->velocity.z = cam->velocity.z + 50000*time*sin(cam->angles.y);
//cam->velocity.x = cam->velocity.x + 500*time*cos(cam->angles.y);
}
if (IsKeyDown(KEY_A)) {
Vector3 forceForward = (Vector3){-500,0,0};
Vector3 rotatedforce = RotateAboutY(forceForward,cam->angles.y);
cam->velocity = Vector3Sum(cam->velocity,rotatedforce);
//cam->velocity.z = cam->velocity.z + 50000*time*sin(cam->angles.y);
//cam->velocity.x = cam->velocity.x + 500*time*cos(cam->angles.y);
}
if (IsKeyDown(KEY_D)) {
Vector3 forceForward = (Vector3){500,0,0};
Vector3 rotatedforce = RotateAboutY(forceForward,cam->angles.y);
cam->velocity = Vector3Sum(cam->velocity,rotatedforce);
//cam->velocity.z = cam->velocity.z + 50000*time*sin(cam->angles.y);
//cam->velocity.x = cam->velocity.x + 500*time*cos(cam->angles.y);
}
if(IsKeyDown(KEY_SPACE)) {
cam->velocity.y = cam->velocity.y - 50;
}
if(IsKeyDown(KEY_LEFT_SHIFT)) {
cam->velocity.y = cam->velocity.y + 50;
}
if (IsKeyDown(KEY_Q)){
cam->angleVelocity.y = cam->angleVelocity.y + time*1000;
}