PlayerController.h indent fix
This commit is contained in:
@@ -32,11 +32,11 @@ const float CROUCH_SHIFT_Y = -0.2f;
|
|||||||
|
|
||||||
|
|
||||||
CameraControl::CameraControl(std::shared_ptr<Player> player, const CameraSettings& settings)
|
CameraControl::CameraControl(std::shared_ptr<Player> player, const CameraSettings& settings)
|
||||||
: player(player),
|
: player(player),
|
||||||
camera(player->camera),
|
camera(player->camera),
|
||||||
currentViewCamera(player->currentCamera),
|
currentViewCamera(player->currentCamera),
|
||||||
settings(settings),
|
settings(settings),
|
||||||
offset(0.0f, 0.7f, 0.0f) {
|
offset(0.0f, 0.7f, 0.0f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraControl::refresh() {
|
void CameraControl::refresh() {
|
||||||
|
|||||||
@@ -12,43 +12,43 @@ class Level;
|
|||||||
class BlocksController;
|
class BlocksController;
|
||||||
|
|
||||||
class CameraControl {
|
class CameraControl {
|
||||||
std::shared_ptr<Player> player;
|
std::shared_ptr<Player> player;
|
||||||
std::shared_ptr<Camera> camera, currentViewCamera;
|
std::shared_ptr<Camera> camera, currentViewCamera;
|
||||||
const CameraSettings& settings;
|
const CameraSettings& settings;
|
||||||
glm::vec3 offset;
|
glm::vec3 offset;
|
||||||
float shake = 0.0f;
|
float shake = 0.0f;
|
||||||
float shakeTimer = 0.0f;
|
float shakeTimer = 0.0f;
|
||||||
glm::vec3 interpVel {0.0f};
|
glm::vec3 interpVel {0.0f};
|
||||||
public:
|
public:
|
||||||
CameraControl(std::shared_ptr<Player> player, const CameraSettings& settings);
|
CameraControl(std::shared_ptr<Player> player, const CameraSettings& settings);
|
||||||
void updateMouse(PlayerInput& input);
|
void updateMouse(PlayerInput& input);
|
||||||
void update(PlayerInput& input, float delta, Chunks* chunks);
|
void update(PlayerInput& input, float delta, Chunks* chunks);
|
||||||
void refresh();
|
void refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlayerController {
|
class PlayerController {
|
||||||
Level* level;
|
Level* level;
|
||||||
std::shared_ptr<Player> player;
|
std::shared_ptr<Player> player;
|
||||||
PlayerInput input;
|
PlayerInput input;
|
||||||
CameraControl camControl;
|
CameraControl camControl;
|
||||||
BlocksController* blocksController;
|
BlocksController* blocksController;
|
||||||
|
|
||||||
void updateKeyboard();
|
void updateKeyboard();
|
||||||
void updateCamera(float delta, bool movement);
|
void updateCamera(float delta, bool movement);
|
||||||
void resetKeyboard();
|
void resetKeyboard();
|
||||||
void updateControls(float delta);
|
void updateControls(float delta);
|
||||||
void updateInteraction();
|
void updateInteraction();
|
||||||
public:
|
public:
|
||||||
static glm::vec3 selectedBlockPosition;
|
static glm::vec3 selectedBlockPosition;
|
||||||
static glm::ivec3 selectedBlockNormal;
|
static glm::ivec3 selectedBlockNormal;
|
||||||
static glm::vec3 selectedPointPosition;
|
static glm::vec3 selectedPointPosition;
|
||||||
static int selectedBlockId;
|
static int selectedBlockId;
|
||||||
static int selectedBlockStates;
|
static int selectedBlockStates;
|
||||||
|
|
||||||
PlayerController(Level* level,
|
PlayerController(Level* level,
|
||||||
const EngineSettings& settings,
|
const EngineSettings& settings,
|
||||||
BlocksController* blocksController);
|
BlocksController* blocksController);
|
||||||
void update(float delta, bool input, bool pause);
|
void update(float delta, bool input, bool pause);
|
||||||
|
|
||||||
Player* getPlayer();
|
Player* getPlayer();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
#include "../core_defs.h"
|
#include "../core_defs.h"
|
||||||
|
|
||||||
using glm::vec3;
|
|
||||||
|
|
||||||
CoordSystem::CoordSystem(glm::ivec3 axisX, glm::ivec3 axisY, glm::ivec3 axisZ)
|
CoordSystem::CoordSystem(glm::ivec3 axisX, glm::ivec3 axisY, glm::ivec3 axisZ)
|
||||||
: axisX(axisX), axisY(axisY), axisZ(axisZ)
|
: axisX(axisX), axisY(axisY), axisZ(axisZ)
|
||||||
{
|
{
|
||||||
fix = glm::ivec3(0);
|
fix = glm::ivec3(0);
|
||||||
if (isVectorHasNegatives(axisX)) fix -= axisX;
|
if (isVectorHasNegatives(axisX)) fix -= axisX;
|
||||||
@@ -14,9 +12,9 @@ CoordSystem::CoordSystem(glm::ivec3 axisX, glm::ivec3 axisY, glm::ivec3 axisZ)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CoordSystem::transform(AABB& aabb) const {
|
void CoordSystem::transform(AABB& aabb) const {
|
||||||
vec3 X(axisX);
|
glm::vec3 X(axisX);
|
||||||
vec3 Y(axisY);
|
glm::vec3 Y(axisY);
|
||||||
vec3 Z(axisZ);
|
glm::vec3 Z(axisZ);
|
||||||
aabb.a = X * aabb.a.x + Y * aabb.a.y + Z * aabb.a.z;
|
aabb.a = X * aabb.a.x + Y * aabb.a.y + Z * aabb.a.z;
|
||||||
aabb.b = X * aabb.b.x + Y * aabb.b.y + Z * aabb.b.z;
|
aabb.b = X * aabb.b.x + Y * aabb.b.y + Z * aabb.b.z;
|
||||||
aabb.a += fix;
|
aabb.a += fix;
|
||||||
|
|||||||
Reference in New Issue
Block a user