1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00

More constexpr

This commit is contained in:
Filip Gawin 2018-02-18 01:47:44 +01:00
parent 5f5e9f7504
commit 2d5d70c1b2
6 changed files with 22 additions and 23 deletions

View File

@ -53,16 +53,6 @@ struct ParticleVert {
float r, g, b;
};
GeometryBuffer particleGeom;
DrawBuffer particleDraw;
std::vector<VertexP2> sspaceRect = {
{-1.f, -1.f}, {1.f, -1.f}, {-1.f, 1.f}, {1.f, 1.f},
};
GeometryBuffer ssRectGeom;
DrawBuffer ssRectDraw;
GameRenderer::GameRenderer(Logger* log, GameData* _data)
: data(_data)
, logger(log)

View File

@ -62,6 +62,16 @@ class GameRenderer {
/// Texture used to replace textures missing from the data
GLuint m_missingTexture;
GeometryBuffer particleGeom;
DrawBuffer particleDraw;
std::vector<VertexP2> sspaceRect = {
{-1.f, -1.f}, {1.f, -1.f}, {-1.f, 1.f}, {1.f, 1.f},
};
GeometryBuffer ssRectGeom;
DrawBuffer ssRectDraw;
public:
GameRenderer(Logger* log, GameData* data);
~GameRenderer();

View File

@ -6,15 +6,14 @@
class ViewCamera {
public:
ViewFrustum frustum;
ViewFrustum frustum{0.1f, 5000.f, glm::radians(45.f), 1.f};
glm::vec3 position;
glm::quat rotation;
ViewCamera(const glm::vec3& pos = {},
const glm::quat& rot = {1.0f,0.0f,0.0f,0.0f})
: frustum({0.1f, 5000.f, glm::radians(45.f), 1.f})
, position(pos)
: position(pos)
, rotation(rot) {
}

View File

@ -25,9 +25,9 @@ const glm::u8vec3 ui_moneyColour(89, 113, 147);
const glm::u8vec3 ui_healthColour(187, 102, 47);
const glm::u8vec3 ui_armourColour(123, 136, 93);
const glm::u8vec3 ui_shadowColour(0, 0, 0);
const float ui_mapSize = 150.f;
const float ui_worldSizeMin = 200.f;
const float ui_worldSizeMax = 300.f;
constexpr float ui_mapSize = 150.f;
constexpr float ui_worldSizeMin = 200.f;
constexpr float ui_worldSizeMax = 300.f;
void drawMap(ViewCamera& currentView, PlayerController* player,
GameWorld* world, GameRenderer* render) {

View File

@ -2,9 +2,9 @@
#include "RWGame.hpp"
// This serves as the "initial" camera position.
ViewCamera defaultView({-250.f, -550.f, 75.f},
const ViewCamera defaultView{{-250.f, -550.f, 75.f},
glm::angleAxis(glm::radians(5.f),
glm::vec3(0.f, 1.f, 0.f)));
glm::vec3(0.f, 1.f, 0.f))};
void State::handleEvent(const SDL_Event& e) {
auto m = getCurrentMenu();

View File

@ -25,10 +25,10 @@
constexpr float kAutoLookTime = 2.f;
constexpr float kAutolookMinVelocity = 0.2f;
const float kInGameFOV = glm::half_pi<float>();
const float kMaxRotationRate = glm::quarter_pi<float>();
const float kCameraPitchLimit = glm::quarter_pi<float>() * 0.5f;
const float kVehicleCameraPitch =
constexpr float kInGameFOV = glm::half_pi<float>();
constexpr float kMaxRotationRate = glm::quarter_pi<float>();
constexpr float kCameraPitchLimit = glm::quarter_pi<float>() * 0.5f;
constexpr float kVehicleCameraPitch =
glm::half_pi<float>() - glm::quarter_pi<float>() * 0.25f;
IngameState::IngameState(RWGame* game, bool newgame, const std::string& save)