- transition smoothly between idle and run animations - use quaternions (versors) instead of yaw/pitch/roll - hide mouse and enable free-look mode by default on startup - rotate model 180 degrees in Blender so it faces away from the camera by default - add some makefile commands
45 lines
698 B
C
45 lines
698 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include "SDL2/SDL.h"
|
|
#include "cglm/cglm.h"
|
|
#include "camera.h"
|
|
#include "shape.h"
|
|
#include "model.h"
|
|
|
|
typedef struct
|
|
{
|
|
bool w;
|
|
bool a;
|
|
bool s;
|
|
bool d;
|
|
bool q;
|
|
bool e;
|
|
bool freeLook;
|
|
} InputState;
|
|
|
|
typedef struct
|
|
{
|
|
bool running;
|
|
bool charIsMoving;
|
|
float animBlend;
|
|
uint64_t previousTicks;
|
|
InputState input;
|
|
SDL_Window *window;
|
|
SDL_GLContext *glContext;
|
|
GLuint textureId;
|
|
int shaderProgramId;
|
|
int modelShaderProgramId;
|
|
Camera camera;
|
|
Shape **shapes;
|
|
int numShapes;
|
|
Model testModel;
|
|
mat4 projMatrix;
|
|
mat4 viewMatrix;
|
|
} GameState;
|
|
|
|
GameState *Game_New();
|
|
void Game_Update(GameState *gs);
|
|
void Game_Destroy(GameState *gs);
|