Redesigned UpdateCamera() function

Splitted into:
UpdateCamera()             // Update only camera
UpdateCameraPlayer()   // Update camera and player position
This commit is contained in:
raysan5 2015-08-30 17:46:19 +02:00
parent 92bcf09c53
commit 535b9e606f
2 changed files with 17 additions and 6 deletions

View File

@ -162,14 +162,24 @@ void SetCameraMode(int mode)
cameraMode = mode;
}
// Update camera with position
// TODO: I don't like how this function works right now... not clear enough...
Camera UpdateCamera(Vector3 *position)
// Update camera (player position is ignored)
void UpdateCamera(Camera *camera)
{
// Calculate camera
Vector3 position = { 0, 0, 0 };
// Process internal camera and player position (if required)
if (cameraMode != CAMERA_CUSTOM) ProcessCamera(&internalCamera, &position);
*camera = internalCamera;
}
// Update camera and player position (1st person and 3rd person cameras)
void UpdateCameraPlayer(Camera *camera, Vector3 *position)
{
// Process internal camera and player position (if required)
if (cameraMode != CAMERA_CUSTOM) ProcessCamera(&internalCamera, position);
return internalCamera;
*camera = internalCamera;
}
// Set internal camera position

View File

@ -76,7 +76,8 @@ extern "C" { // Prevents name mangling of functions
// Module Functions Declaration
//----------------------------------------------------------------------------------
void SetCameraMode(int mode); // Set camera mode (multiple camera modes available)
Camera UpdateCamera(Vector3 *position); // Update camera and player position (1st person and 3rd person cameras)
void UpdateCamera(Camera *camera); // Update camera (player position is ignored)
void UpdateCameraPlayer(Camera *camera, Vector3 *position); // Update camera and player position (1st person and 3rd person cameras)
void SetCameraPosition(Vector3 position); // Set internal camera position
void SetCameraTarget(Vector3 target); // Set internal camera target