Camera smoothing.
This commit is contained in:
@ -40,15 +40,16 @@ void pokerWorldInit(
|
||||
void pokerWorldLookAtPlayer(
|
||||
vnscene_t *scene, uint8_t playerIndex
|
||||
) {
|
||||
uint8_t seat = pokerGameSeatFromIndex(playerIndex);
|
||||
vnSceneLookAt(scene,
|
||||
scene->cameraLook.x,
|
||||
scene->cameraLook.y,
|
||||
scene->cameraLook.z,
|
||||
POKER_WORLD_SEAT_POSITION_X(seat),
|
||||
scene->cameraLook.lookY,
|
||||
POKER_WORLD_SEAT_POSITION_Z(seat)
|
||||
);
|
||||
vnSceneLookAtCharacter(scene, playerIndex, -1);
|
||||
// uint8_t seat = pokerGameSeatFromIndex(playerIndex);
|
||||
// vnSceneLookAtCharacter(scene,
|
||||
// scene->cameraLook.x,
|
||||
// scene->cameraLook.y,
|
||||
// scene->cameraLook.z,
|
||||
// POKER_WORLD_SEAT_POSITION_X(seat),
|
||||
// scene->cameraLook.lookY,
|
||||
// POKER_WORLD_SEAT_POSITION_Z(seat)
|
||||
// );
|
||||
}
|
||||
|
||||
void pokerWorldRender(pokerworld_t *world, pokergameassets_t *assets) {
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "pokergameassets.h"
|
||||
|
||||
|
||||
#define POKER_WORLD_SEAT_DISTANCE -1
|
||||
#define POKER_WORLD_SEAT_DISTANCE -0.75f
|
||||
#define POKER_WORLD_SEAT_ROTATION(n) (n * mathDeg2Rad(45.0f))
|
||||
|
||||
#define POKER_WORLD_SEAT_POSITION_X(n) ( \
|
||||
|
@ -21,7 +21,7 @@ void vnSceneInit(vnscene_t *scene, font_t *font, texture_t *text) {
|
||||
scene->cameraLook.z = 0;
|
||||
scene->cameraLook.lookX = 0;
|
||||
scene->cameraLook.lookY = 0;
|
||||
scene->cameraLook.lookZ = 0;
|
||||
scene->cameraLook.lookZ = VN_SCENE_DISTANCE_DEFAULT;
|
||||
|
||||
// Reset character count
|
||||
scene->characterCount = 0x00;
|
||||
@ -135,4 +135,13 @@ void vnSceneLookAt(vnscene_t *scene,
|
||||
|
||||
void vnSceneLookAtCharacter(vnscene_t *scene, uint8_t c, float distance) {
|
||||
vncharacter_t *character = scene->characters + c;
|
||||
|
||||
vnSceneLookAt(scene,
|
||||
-distance * sinf(character->yaw) + character->x,
|
||||
scene->cameraLook.y,
|
||||
-distance * cosf(character->yaw) + character->z,
|
||||
character->x,
|
||||
scene->cameraLook.lookY,
|
||||
character->z
|
||||
);
|
||||
}
|
@ -51,4 +51,6 @@ void vnSceneRenderGui(vnscene_t *scene, engine_t *engine, shader_t *shader);
|
||||
|
||||
void vnSceneLookAt(vnscene_t *scene,
|
||||
float x, float y, float z, float lookX, float lookY, float lookZ
|
||||
);
|
||||
);
|
||||
|
||||
void vnSceneLookAtCharacter(vnscene_t *scene, uint8_t c, float distance);
|
Reference in New Issue
Block a user