1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-21 18:02:43 +01:00

Stop using default initialization onglm datatypes.

It results in undefined behaviour with glm 0.9.9
This commit is contained in:
Lucas Eriksson 2018-02-06 20:47:31 +01:00 committed by Daniel Evans
parent 5bf92e5a0b
commit 3e96ad9c92
54 changed files with 172 additions and 167 deletions

View File

@ -14,7 +14,7 @@ struct AIGraphNode {
};
NodeType type;
glm::vec3 position;
glm::vec3 position{};
float size;
int other_thing;
int other_thing2;

View File

@ -4,7 +4,7 @@
#include <ai/CharacterController.hpp>
class DefaultAIController : public CharacterController {
glm::vec3 gotoPos;
glm::vec3 gotoPos{};
public:
DefaultAIController()

View File

@ -6,9 +6,9 @@
#include <ai/CharacterController.hpp>
class PlayerController : public CharacterController {
glm::quat cameraRotation;
glm::quat cameraRotation{1.0f,0.0f,0.0f,0.0f};
glm::vec3 direction;
glm::vec3 direction{};
glm::quat lastRotation;

View File

@ -31,7 +31,7 @@ bool ChaseKeyframe::load(const std::string &filePath,
uint8_t driving;
uint8_t braking;
uint8_t handbrake;
glm::vec3 position;
glm::vec3 position{};
};
static_assert(sizeof(ChaseEntryRecord) == 28,

View File

@ -19,14 +19,14 @@ struct CollisionModel {
/// @todo give shapes surface data
struct Sphere {
glm::vec3 center;
glm::vec3 center{};
float radius;
Surface surface;
};
struct Box {
glm::vec3 min;
glm::vec3 max;
glm::vec3 min{};
glm::vec3 max{};
Surface surface;
};

View File

@ -21,7 +21,7 @@ struct CutsceneMetadata {
std::string name;
/// The origin for coordinates in the cutscene
glm::vec3 sceneOffset;
glm::vec3 sceneOffset{};
std::vector<ModelEntry> models;
std::map<float, TextEntry> texts;

View File

@ -14,7 +14,7 @@ struct PathNode {
NodeType type;
int32_t next;
glm::vec3 position;
glm::vec3 position{};
float size;
int other_thing;
int other_thing2;

View File

@ -18,7 +18,7 @@ struct WeaponData {
float meleeRadius;
float lifeSpan;
float spread;
glm::vec3 fireOffset;
glm::vec3 fireOffset{};
std::string animation1;
std::string animation2;
float animLoopStart;
@ -51,10 +51,10 @@ struct WeaponScan {
float damage;
glm::vec3 center;
glm::vec3 center{};
float radius;
glm::vec3 end;
glm::vec3 end{};
WeaponData* weapon;

View File

@ -13,12 +13,12 @@ enum class WeatherCondition { Sunny = 0, Cloudy = 1, Rainy = 2, Foggy = 3 };
class Weather {
public:
struct Entry {
glm::vec3 ambientColor;
glm::vec3 directLightColor;
glm::vec3 skyTopColor;
glm::vec3 skyBottomColor;
glm::vec3 sunCoreColor;
glm::vec3 sunCoronaColor;
glm::vec3 ambientColor{};
glm::vec3 directLightColor{};
glm::vec3 skyTopColor{};
glm::vec3 skyBottomColor{};
glm::vec3 sunCoreColor{};
glm::vec3 sunCoronaColor{};
float sunCoreSize;
float sunCoronaSize;
float sunBrightness;
@ -28,9 +28,9 @@ public:
float farClipping;
float fogStart;
float amountGroundLight;
glm::vec3 lowCloudColor;
glm::vec3 topCloudColor;
glm::vec3 bottomCloudColor;
glm::vec3 lowCloudColor{};
glm::vec3 topCloudColor{};
glm::vec3 bottomCloudColor{};
uint8_t unknown[4];
};

View File

@ -16,24 +16,24 @@ struct ZoneData {
/**
* The name of the Zone (see .gxt)
*/
std::string name;
std::string name{};
int type;
int type{};
/**
* Bottom left of the Zone
*/
glm::vec3 min;
glm::vec3 min{};
/**
* Top Right of the zone
*/
glm::vec3 max;
glm::vec3 max{};
/**
* Island number
*/
int island;
int island{};
/**
* Text of the zone?

View File

@ -19,8 +19,8 @@ void Animator::tick(float dt) {
}
struct BoneTransform {
glm::vec3 translation;
glm::quat rotation;
glm::vec3 translation{};
glm::quat rotation{1.0f,0.0f,0.0f,0.0f};
};
#if 0

View File

@ -99,10 +99,12 @@ GameState::GameState()
, maxWantedLevel(0)
, playerObject(0)
, scriptOnMissionFlag(nullptr)
, nextRestartLocation{}
, fadeOut(true)
, fadeStart(0.f)
, fadeTime(0.f)
, fadeSound(false)
, fadeColour{}
, skipCutscene(false)
, isIntroPlaying(false)
, currentCutscene(nullptr)
@ -111,6 +113,8 @@ GameState::GameState()
, hudFlash(HudFlash::Disabled)
, cameraNear(0.1f)
, cameraFixed(false)
, cameraPosition{}
, cameraRotation{1.0f,0.0f,0.0f,0.0f}
, cameraTarget(0)
, importExportPortland(0)
, importExportShoreside(0)

View File

@ -159,10 +159,10 @@ struct GameStats {
struct TextDisplayData {
// This is set by the final display text command.
GameString text;
glm::vec2 position;
glm::vec2 position{};
glm::vec4 colourFG;
glm::vec4 colourBG;
glm::vec4 colourFG{};
glm::vec4 colourBG{};
};
/**
@ -181,7 +181,7 @@ struct BlipData {
BlipType type;
GameObjectID target;
// If target is null then use coord
glm::vec3 coord;
glm::vec3 coord{};
std::string texture; // Texture for use in the radar
uint32_t colour = 0; // Color value (index or RGBA)

View File

@ -59,8 +59,8 @@ struct AreaIndicatorInfo {
enum AreaIndicatorType { Cylinder };
AreaIndicatorType type;
glm::vec3 position;
glm::vec3 radius;
glm::vec3 position{};
glm::vec3 radius{};
};
/**
@ -102,34 +102,34 @@ public:
* Creates an instance
*/
InstanceObject* createInstance(const uint16_t id, const glm::vec3& pos,
const glm::quat& rot = glm::quat());
const glm::quat& rot = glm::quat{1.0f,0.0f,0.0f,0.0f});
/**
* @brief Creates an InstanceObject for use in the current Cutscene.
*/
CutsceneObject* createCutsceneObject(const uint16_t id,
const glm::vec3& pos,
const glm::quat& rot = glm::quat());
const glm::quat& rot = glm::quat{1.0f,0.0f,0.0f,0.0f});
/**
* Creates a vehicle
*/
VehicleObject* createVehicle(const uint16_t id, const glm::vec3& pos,
const glm::quat& rot = glm::quat(),
const glm::quat& rot = glm::quat{1.0f,0.0f,0.0f,0.0f},
GameObjectID gid = 0);
/**
* Creates a pedestrian.
*/
CharacterObject* createPedestrian(const uint16_t id, const glm::vec3& pos,
const glm::quat& rot = glm::quat(),
const glm::quat& rot = glm::quat{1.0f,0.0f,0.0f,0.0f},
GameObjectID gid = 0);
/**
* Creates a player
*/
CharacterObject* createPlayer(const glm::vec3& pos,
const glm::quat& rot = glm::quat(),
const glm::quat& rot = glm::quat{1.0f,0.0f,0.0f,0.0f},
GameObjectID gid = 0);
/**

View File

@ -108,7 +108,7 @@ struct StructWeaponSlot {
};
struct StructPed {
uint8_t unknown0_[52];
glm::vec3 position;
glm::vec3 position{};
uint8_t unknown1[640];
float health;
float armour;
@ -130,8 +130,8 @@ struct Block1PlayerPed {
struct StructStoredCar {
BlockDword modelId;
glm::vec3 position;
glm::vec3 rotation;
glm::vec3 position{};
glm::vec3 rotation{};
BlockDword immunities;
uint8_t colorFG;
uint8_t colorBG;
@ -186,8 +186,8 @@ struct StructGarage {
float z2;
float doorOpenStart;
float doorOpenAngle;
glm::vec2 unknownCoord1;
glm::vec2 unknownCoord2;
glm::vec2 unknownCoord1{};
glm::vec2 unknownCoord2{};
float doorAZ;
float doorBZ;
BlockDword unknown15;
@ -228,7 +228,7 @@ struct Block2GarageData {
struct Block3VehicleState {
uint8_t unknown1[52];
glm::vec3 position;
glm::vec3 position{};
uint8_t unknown2[1384];
};
@ -241,7 +241,7 @@ struct Block3Vehicle {
struct Block3BoatState {
uint8_t unknown1[52];
glm::vec3 position;
glm::vec3 position{};
uint8_t unknown2[1092];
};
@ -255,7 +255,7 @@ struct Block3Boat {
struct Block4Object {
BlockWord modelId;
BlockDword reference;
glm::vec3 position;
glm::vec3 position{};
int8_t rotation[9]; /// @todo Confirm that this is: right, forward, down
uint8_t unknown1[3];
float unknown2;
@ -277,7 +277,7 @@ struct Block6Crane {
float y1Pickup;
float x2Pickup;
float y2Pickup;
glm::vec3 dropoff;
glm::vec3 dropoff{};
float dropoffHeadingRads;
float pickupArmRads;
float dropoffArmRads;
@ -288,8 +288,8 @@ struct Block6Crane {
float armCurrentRads;
float armCurrentDistance;
float armCurrentHeight;
glm::vec3 hookInitialPosition;
glm::vec3 hookCurrentPosition;
glm::vec3 hookInitialPosition{};
glm::vec3 hookCurrentPosition{};
float unknown1[2];
BlockDword vehiclePtr;
BlockDword gameTime;
@ -317,7 +317,7 @@ struct Block7Pickup {
BlockDword regenTime;
BlockWord modelId;
BlockWord flags;
glm::vec3 position;
glm::vec3 position{};
};
struct Block7Data {
@ -333,7 +333,7 @@ struct Block8Data {
};
struct Block8Phone {
glm::vec3 position;
glm::vec3 position{};
BlockDword messagePtr[6];
BlockDword messageEndTime;
BlockDword staticIndex;
@ -343,7 +343,7 @@ struct Block8Phone {
};
struct Block9Restart {
glm::vec3 position;
glm::vec3 position{};
float angle;
};
@ -367,7 +367,7 @@ struct Block10Blip {
BlockDword entityHandle;
float unknown1;
float unknown2;
glm::vec3 position;
glm::vec3 position{};
BlockWord unknown3;
uint8_t brightness;
uint8_t unknown4;
@ -384,8 +384,8 @@ struct Block10Data {
struct Block11Zone {
char name[8];
glm::vec3 coordA;
glm::vec3 coordB;
glm::vec3 coordA{};
glm::vec3 coordB{};
BlockDword type;
BlockDword level;
BlockWord dayZoneInfo;
@ -435,7 +435,7 @@ struct Block12Data {
struct Block13CarGenerator {
BlockDword modelId;
glm::vec3 position;
glm::vec3 position{};
float angle;
BlockWord colourFG;
BlockWord colourBG;
@ -475,7 +475,7 @@ struct Block15AudioObject {
BlockDword index;
BlockWord soundIndex;
uint8_t align[2];
glm::vec3 position;
glm::vec3 position{};
BlockDword unknown1;
};

View File

@ -37,15 +37,15 @@ struct ScreenTextEntry {
/// After processing numbers
GameString text;
/// in the virtual 640x480 screen space
glm::vec2 position;
glm::vec2 position{};
/// Font number
int font;
/// Font size
int size;
/// Background colour (or, if a == 0, shadow offset)
glm::u8vec4 colourBG;
glm::u8vec4 colourBG{};
/// Foreground colour
glm::u8vec3 colourFG;
glm::u8vec3 colourFG{};
/// Alignment (left = 0, center = 1, right = 2)
unsigned char alignment;
/// Onscreen duration

View File

@ -13,9 +13,9 @@
#include <rw/forward.hpp>
struct AnimationKeyframe {
glm::quat rotation;
glm::vec3 position;
glm::vec3 scale;
glm::quat rotation{1.0f,0.0f,0.0f,0.0f};
glm::vec3 position{};
glm::vec3 scale{1.0f};
float starttime = 0.f;
int id = 0;

View File

@ -120,7 +120,7 @@ void CharacterObject::destroyActor() {
}
glm::vec3 CharacterObject::updateMovementAnimation(float dt) {
glm::vec3 animTranslate;
glm::vec3 animTranslate{};
if (motionBlockedByActivity) {
// Clear any residual motion animation

View File

@ -61,8 +61,8 @@ private:
void createActor(const glm::vec2& size = glm::vec2(0.45f, 1.2f));
void destroyActor();
glm::vec3 movement;
glm::vec2 m_look;
glm::vec3 movement{};
glm::vec2 m_look{};
bool running;
bool jumped;
@ -71,7 +71,7 @@ private:
bool motionBlockedByActivity;
glm::vec3 updateMovementAnimation(float dt);
glm::vec3 currenteMovementStep;
glm::vec3 currenteMovementStep{};
AnimCycle cycle_;

View File

@ -161,12 +161,12 @@ public:
/**
* World position of damage
*/
glm::vec3 damageLocation;
glm::vec3 damageLocation{};
/**
* World position of the source (used for direction)
*/
glm::vec3 damageSource;
glm::vec3 damageSource{};
/**
* Magnitude of destruction
@ -209,7 +209,7 @@ public:
}
glm::mat4 getTimeAdjustedTransform(float alpha) const {
glm::mat4 t;
glm::mat4 t{1.0f};
t = glm::translate(t, glm::mix(_lastPosition, getPosition(), alpha));
t = t * glm::mat4_cast(glm::slerp(_lastRotation, getRotation(), alpha));
return t;

View File

@ -84,7 +84,7 @@ uint32_t PickupObject::behaviourFlags(PickupType type) {
PickupObject::PickupObject(GameWorld* world, const glm::vec3& position,
BaseModelInfo* modelinfo, PickupType type)
: GameObject(world, position, glm::quat(), modelinfo)
: GameObject(world, position, glm::quat{1.0f,0.0f,0.0f,0.0f}, modelinfo)
, m_ghost(nullptr)
, m_shape(nullptr)
, m_enabled(false)

View File

@ -113,7 +113,7 @@ void ProjectileObject::cleanup() {
ProjectileObject::ProjectileObject(GameWorld* world, const glm::vec3& position,
const ProjectileObject::ProjectileInfo& info)
: GameObject(world, position, glm::quat(), nullptr)
: GameObject(world, position, glm::quat{1.0f,0.0f,0.0f,0.0f}, nullptr)
, _info(info)
, _body(nullptr)
, _ghostBody(nullptr)

View File

@ -24,7 +24,7 @@ public:
struct ProjectileInfo {
ProjectileType type;
glm::vec3 direction;
glm::vec3 direction{};
float velocity;
/** Time to dentonation or removal */

View File

@ -19,8 +19,8 @@ struct VehicleHandlingInfo {
std::string ID;
float mass;
glm::vec3 dimensions;
glm::vec3 centerOfMass;
glm::vec3 dimensions{};
glm::vec3 centerOfMass{};
float percentSubmerged;
float tractionMulti;
float tractionLoss;
@ -65,11 +65,11 @@ struct VehicleHandlingInfo {
};
struct WheelInfo {
glm::vec3 position;
glm::vec3 position{};
};
struct SeatInfo {
glm::vec3 offset;
glm::vec3 offset{};
};
/**

View File

@ -351,7 +351,7 @@ void VehicleObject::tickPhysics(float dt) {
for (auto& seat : seatOccupants) {
auto character = static_cast<CharacterObject*>(seat.second);
glm::vec3 passPosition;
glm::vec3 passPosition{};
if (character->isEnteringOrExitingVehicle()) {
passPosition = getSeatEntryPositionWorld(seat.first);
} else {

View File

@ -328,7 +328,7 @@ void GameRenderer::renderWorld(GameWorld* world, const ViewCamera& camera,
continue;
}
glm::mat4 model;
glm::mat4 model{1.0f};
if (blip.second.target > 0) {
auto object = world->getBlipTarget(blip.second);
@ -390,7 +390,7 @@ void GameRenderer::renderWorld(GameWorld* world, const ViewCamera& camera,
renderer->setUniform(skyProg.get(), "BottomColor",
glm::vec4{weather.skyBottomColor, 1.f});
renderer->draw(glm::mat4(), &skyDbuff, dp);
renderer->draw(glm::mat4(1.0f), &skyDbuff, dp);
profSky = renderer->popDebugGroup();
@ -471,7 +471,7 @@ void GameRenderer::renderPostProcess() {
wdp.count = ssRectGeom.getCount();
wdp.textures = {fbTextures[0]};
renderer->drawArrays(glm::mat4(), &ssRectDraw, wdp);
renderer->drawArrays(glm::mat4(1.0f), &ssRectDraw, wdp);
}
void GameRenderer::renderEffects(GameWorld* world) {

View File

@ -88,9 +88,9 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
float worldScale = mi.screenSize / mi.worldSize;
auto proj = renderer->get2DProjection();
glm::mat4 view, model;
glm::mat4 view{1.0f}, model{1.0f};
renderer->setUniform(rectProg.get(), "proj", proj);
renderer->setUniform(rectProg.get(), "model", glm::mat4());
renderer->setUniform(rectProg.get(), "model", glm::mat4(1.0f));
renderer->setUniform(rectProg.get(), "colour", glm::vec4(0.f, 0.f, 0.f, 1.f));
view = glm::translate(view, glm::vec3(mi.screenPosition, 0.f));
@ -104,7 +104,7 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glStencilMask(0xFF);
glColorMask(0x00, 0x00, 0x00, 0x00);
renderer->drawArrays(glm::mat4(), &circle, dp);
renderer->drawArrays(glm::mat4(1.0f), &circle, dp);
glColorMask(0xFF, 0xFF, 0xFF, 0xFF);
glStencilFunc(GL_EQUAL, 1, 0xFF);
}
@ -140,11 +140,11 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
renderer->setUniform(rectProg.get(), "model", tilemodel);
renderer->drawArrays(glm::mat4(), &rect, dp);
renderer->drawArrays(glm::mat4(1.0f), &rect, dp);
}
// From here on out we will work in screenspace
renderer->setUniform(rectProg.get(), "view", glm::mat4());
renderer->setUniform(rectProg.get(), "view", glm::mat4(1.0f));
if (mi.clipToSize) {
glDisable(GL_STENCIL_TEST);
@ -154,11 +154,11 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
data->findSlotTexture("hud", "radardisc");
dp.textures = {radarDisc->getName()};
glm::mat4 model;
glm::mat4 model{1.0f};
model = glm::translate(model, glm::vec3(mi.screenPosition, 0.0f));
model = glm::scale(model, glm::vec3(mi.screenSize * 1.07f));
renderer->setUniform(rectProg.get(), "model", model);
renderer->drawArrays(glm::mat4(), &rect, dp);
renderer->drawArrays(glm::mat4(1.0f), &rect, dp);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE,
GL_ZERO);
}
@ -256,7 +256,7 @@ void MapRenderer::prepareBlip(const glm::vec2& coord, const glm::mat4& view,
glm::vec3 viewPos(
view * glm::vec4(glm::vec2(1.f, -1.f) * adjustedCoord, 0.f, 1.f));
glm::mat4 model;
glm::mat4 model{1.0f};
model = glm::translate(model, viewPos);
model = glm::scale(model, glm::vec3(size));
model = glm::rotate(model, heading, glm::vec3(0.f, 0.f, 1.f));

View File

@ -23,14 +23,14 @@ class MapRenderer {
public:
struct MapInfo {
/// World coordinate center
glm::vec2 worldCenter;
glm::vec2 worldCenter{};
/// World units to fit on the map
float worldSize;
/// yaw of the map
float rotation = 0.f;
glm::vec2 screenPosition;
glm::vec2 screenPosition{};
float screenSize;
/// Make the map circular, or don't.
bool clipToSize = true;

View File

@ -204,7 +204,7 @@ void ObjectRenderer::renderInstance(InstanceObject* instance,
}
// Render the atomic the instance thinks it should be
renderAtomic(atomic.get(), glm::mat4(), instance, outList);
renderAtomic(atomic.get(), glm::mat4(1.0f), instance, outList);
}
void ObjectRenderer::renderCharacter(CharacterObject* pedestrian,
@ -229,7 +229,7 @@ void ObjectRenderer::renderCharacter(CharacterObject* pedestrian,
}
}
renderClump(pedestrian->getClump().get(), glm::mat4(), nullptr, outList);
renderClump(pedestrian->getClump().get(), glm::mat4(1.0f), nullptr, outList);
auto item = pedestrian->getActiveItem();
const auto& weapon = pedestrian->engine->data->weaponData[item];
@ -268,7 +268,7 @@ void ObjectRenderer::renderVehicle(VehicleObject* vehicle,
vehicle->getLowLOD()->setFlag(Atomic::ATOMIC_RENDER, !highLOD);
}
renderClump(clump.get(), glm::mat4(), vehicle, outList);
renderClump(clump.get(), glm::mat4(1.0f), vehicle, outList);
auto modelinfo = vehicle->getVehicle();
auto woi =
@ -295,7 +295,7 @@ void ObjectRenderer::renderVehicle(VehicleObject* vehicle,
btMatrix3x3(steerQ) * btMatrix3x3(rollQ) * basis,
wi.m_chassisConnectionPointCS +
wi.m_wheelDirectionCS * wi.m_raycastInfo.m_suspensionLength);
glm::mat4 wheelM;
glm::mat4 wheelM{1.0f};
t.getOpenGLMatrix(glm::value_ptr(wheelM));
wheelM = clump->getFrame()->getWorldTransform() * wheelM;
wheelM = glm::scale(wheelM, glm::vec3(modelinfo->wheelscale_));
@ -310,7 +310,7 @@ void ObjectRenderer::renderVehicle(VehicleObject* vehicle,
void ObjectRenderer::renderPickup(PickupObject* pickup, RenderList& outList) {
if (!pickup->isEnabled()) return;
glm::mat4 modelMatrix = glm::translate(glm::mat4(), pickup->getPosition());
glm::mat4 modelMatrix = glm::translate(glm::mat4(1.0f), pickup->getPosition());
modelMatrix = glm::rotate(modelMatrix, m_world->getGameTime(),
glm::vec3(0.f, 0.f, 1.f));
@ -328,7 +328,7 @@ void ObjectRenderer::renderCutsceneObject(CutsceneObject* cutscene,
auto cutsceneOffset = m_world->state->currentCutscene->meta.sceneOffset +
glm::vec3(0.f, 0.f, 1.f);
glm::mat4 cutscenespace;
glm::mat4 cutscenespace{1.0f};
cutscenespace = glm::translate(cutscenespace, cutsceneOffset);
if (cutscene->getParentActor()) {

View File

@ -23,7 +23,7 @@ typedef uint64_t RenderKey;
typedef std::uint32_t RenderIndex;
struct VertexP2 {
glm::vec2 position;
glm::vec2 position{};
static const AttributeList vertex_attributes() {
return {{ATRS_Position, 2, sizeof(VertexP2), 0ul}};
@ -39,7 +39,7 @@ struct VertexP2 {
struct VertexP3 {
glm::vec3 position;
glm::vec3 position{};
static const AttributeList vertex_attributes() {
return {
@ -80,7 +80,7 @@ public:
// Depth writing state
bool depthWrite;
/// Material
glm::u8vec4 colour;
glm::u8vec4 colour{};
/// Material
float ambient;
/// Material
@ -120,20 +120,20 @@ public:
typedef std::vector<RenderInstruction> RenderList;
struct ObjectUniformData {
glm::mat4 model;
glm::vec4 colour;
glm::mat4 model{1.0f};
glm::vec4 colour{1.0f};
float diffuse;
float ambient;
float visibility;
};
struct SceneUniformData {
glm::mat4 projection;
glm::mat4 view;
glm::vec4 ambient;
glm::vec4 dynamic;
glm::vec4 fogColour;
glm::vec4 campos;
glm::mat4 projection{1.0f};
glm::mat4 view{1.0f};
glm::vec4 ambient{};
glm::vec4 dynamic{};
glm::vec4 fogColour{};
glm::vec4 campos{};
float fogStart;
float fogEnd;
};
@ -234,8 +234,8 @@ public:
virtual const ProfileInfo& popDebugGroup() = 0;
private:
glm::ivec2 viewport;
glm::mat4 projection2D;
glm::ivec2 viewport{};
glm::mat4 projection2D{1.0f};
protected:
int drawCounter;

View File

@ -302,7 +302,7 @@ void TextRenderer::renderText(const TextRenderer::TextInfo& ti,
dp.textures = {ftexture->getName()};
dp.depthWrite = false;
renderer->getRenderer()->drawArrays(glm::mat4(), &db, dp);
renderer->getRenderer()->drawArrays(glm::mat4(1.0f), &db, dp);
renderer->getRenderer()->popDebugGroup();
}

View File

@ -35,13 +35,13 @@ public:
/// Message to be displayed (including markup)
GameString text;
/// On screen position
glm::vec2 screenPosition;
glm::vec2 screenPosition{};
/// font size
float size;
/// Base colour
glm::u8vec3 baseColour;
glm::u8vec3 baseColour{};
/// Background colour
glm::u8vec4 backgroundColour;
glm::u8vec4 backgroundColour{};
/// Horizontal Alignment
TextAlignemnt align;
/// Wrap width

View File

@ -11,7 +11,8 @@ public:
glm::vec3 position;
glm::quat rotation;
ViewCamera(const glm::vec3& pos = {}, const glm::quat& rot = {})
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)
, rotation(rot) {

View File

@ -12,8 +12,8 @@ class ViewFrustum {
public:
class ViewPlane {
public:
glm::vec3 normal;
float distance;
glm::vec3 normal{};
float distance{};
};
float near;

View File

@ -40,7 +40,7 @@ VisualFX::~VisualFX() {
}
const glm::vec3& VisualFX::getPosition() const {
static glm::vec3 errorRef;
static glm::vec3 errorRef{};
switch (type) {
case VisualFX::Particle:
return particle.position;

View File

@ -17,10 +17,10 @@ public:
};
struct ParticleData {
/** Initial world position */
glm::vec3 position;
glm::vec3 position{};
/** Direction of particle */
glm::vec3 direction;
glm::vec3 direction{};
/** Particle orientation modes */
enum Orientation {

View File

@ -99,7 +99,7 @@ public:
*/
int activeEntry;
glm::vec2 offset;
glm::vec2 offset{};
void draw(GameRenderer* r) {
glm::vec2 basis(offset);

View File

@ -43,7 +43,7 @@ class RWGame : public GameBase {
};
DebugViewMode debugview_ = DebugViewMode::Disabled;
int lastDraws; /// Number of draws issued for the last frame.
int lastDraws{}; /// Number of draws issued for the last frame.
std::string cheatInputWindow = std::string(32, ' ');

View File

@ -24,7 +24,7 @@ void BenchmarkState::enter() {
game->getWorld()->state->basic.gameMinute = clockMinute;
float time = 0.f;
glm::vec3 tmpPos;
glm::vec3 tmpPos{};
while (benchstream) {
TrackPoint point;
benchstream >> point.time;

View File

@ -6,8 +6,8 @@
class BenchmarkState : public State {
struct TrackPoint {
float time;
glm::vec3 position;
glm::quat angle;
glm::vec3 position{};
glm::quat angle{1.0f,0.0f,0.0f,0.0f};
};
std::vector<TrackPoint> track;

View File

@ -352,7 +352,7 @@ void DebugState::spawnFollower(unsigned int id) {
glm::vec3 fwd = ch->rotation * glm::vec3(0.f, 1.f, 0.f);
glm::vec3 hit, normal;
glm::vec3 hit{}, normal{};
if (game->hitWorldRay(ch->position + (fwd * 10.f), {0.f, 0.f, -2.f}, hit,
normal)) {
auto spawnPos = hit + normal;

View File

@ -5,8 +5,8 @@
class DebugState : public State {
ViewCamera _debugCam;
glm::vec3 _movement;
glm::vec2 _debugLook;
glm::vec3 _movement{};
glm::vec2 _debugLook{};
bool _freeLook = false;
bool _sonicMode = false;
bool _invertedY;
@ -19,7 +19,7 @@ class DebugState : public State {
public:
DebugState(RWGame* game, const glm::vec3& vp = {},
const glm::quat& vd = {});
const glm::quat& vd = {1.0f,0.0f,0.0f,0.0f});
void enter() override;

View File

@ -193,7 +193,7 @@ void IngameState::tick(float dt) {
}
}
glm::vec3 movement;
glm::vec3 movement{};
movement.x = input(GameInputState::GoForward) -
input(GameInputState::GoBackwards),
movement.y =

View File

@ -20,13 +20,13 @@ class IngameState : public State {
std::string save;
bool newgame;
ViewCamera _look;
glm::vec3 cameraPosition;
glm::vec3 cameraPosition{};
/** Timer to hold user camera position */
float autolookTimer;
CameraMode camMode;
/// Player camera input since the last update
glm::vec2 cameradelta_;
glm::vec2 cameradelta_{};
/// Invert Y axis movement
bool m_invertedY;
/// Free look in vehicles.

View File

@ -23,7 +23,7 @@ ModelFrame::ModelFrame(unsigned int index, glm::mat3 dR, glm::vec3 dT)
}
void ModelFrame::reset() {
matrix = glm::translate(glm::mat4(), defaultTranslation) *
matrix = glm::translate(glm::mat4(1.0f), defaultTranslation) *
glm::mat4(defaultRotation);
updateHierarchyTransform();
}

View File

@ -22,14 +22,14 @@ class ModelFrame {
unsigned int index;
glm::mat3 defaultRotation;
glm::vec3 defaultTranslation;
glm::mat4 matrix;
glm::mat4 worldtransform_;
glm::mat4 matrix{1.0f};
glm::mat4 worldtransform_{1.0f};
ModelFrame* parent_;
std::string name;
std::vector<ModelFramePtr> children_;
public:
ModelFrame(unsigned int index = 0, glm::mat3 dR = glm::mat3(),
ModelFrame(unsigned int index = 0, glm::mat3 dR = glm::mat3{1.0f},
glm::vec3 dT = glm::vec3());
void reset();
@ -114,10 +114,10 @@ struct SubGeometry {
};
struct GeometryVertex {
glm::vec3 position; /* 0 */
glm::vec3 normal; /* 24 */
glm::vec2 texcoord; /* 48 */
glm::u8vec4 colour; /* 64 */
glm::vec3 position{}; /* 0 */
glm::vec3 normal{}; /* 24 */
glm::vec2 texcoord{}; /* 48 */
glm::u8vec4 colour{}; /* 64 */
/** @see GeometryBuffer */
static const AttributeList vertex_attributes() {
@ -155,7 +155,7 @@ struct Geometry {
struct Material {
std::vector<Texture> textures;
glm::u8vec4 colour;
glm::u8vec4 colour{};
uint8_t flags;

View File

@ -69,7 +69,7 @@ void ViewerWidget::initGL() {
}
void ViewerWidget::drawModel(GameRenderer& r, ClumpPtr& model) {
glm::mat4 view, proj;
glm::mat4 view{1.0f}, proj{1.0f};
const auto& vc = OrbitCamera({width(), height()},
viewAngles,
viewDistance,
@ -83,7 +83,7 @@ void ViewerWidget::drawModel(GameRenderer& r, ClumpPtr& model) {
ObjectRenderer _renderer(world(), vc, 1.f, 0);
RenderList renders;
_renderer.renderClump(model.get(), glm::mat4(), nullptr, renders);
_renderer.renderClump(model.get(), glm::mat4(1.0f), nullptr, renders);
r.getRenderer()->drawBatched(renders);
drawFrameWidget(model->getFrame().get());
@ -91,7 +91,7 @@ void ViewerWidget::drawModel(GameRenderer& r, ClumpPtr& model) {
}
void ViewerWidget::drawObject(GameRenderer &r, GameObject *object) {
glm::mat4 view, proj;
glm::mat4 view{1.0f}, proj{1.0f};
const auto& vc = OrbitCamera({width(), height()},
viewAngles,
viewDistance,
@ -263,7 +263,7 @@ void ViewerWidget::exportModel() {
void ViewerWidget::keyPressEvent(QKeyEvent* e) {
if (e->key() == Qt::Key_Shift) moveFast = true;
glm::vec3 movement;
glm::vec3 movement{};
if (e->key() == Qt::Key_W) movement.y += moveFast ? 10.f : 1.f;
if (e->key() == Qt::Key_S) movement.y -= moveFast ? 10.f : 1.f;
if (e->key() == Qt::Key_A) movement.x -= moveFast ? 10.f : 1.f;

View File

@ -85,12 +85,12 @@ protected:
float viewDistance;
glm::vec2 viewAngles;
glm::vec3 viewPosition;
glm::vec2 viewAngles{};
glm::vec3 viewPosition{};
bool dragging;
QPointF dstart;
glm::vec2 dastart;
glm::vec2 dastart{};
bool moveFast;
DrawBuffer* _frameWidgetDraw;

View File

@ -26,8 +26,8 @@ BOOST_AUTO_TEST_CASE(test_matrix) {
1.0f,
AnimationBone::RT0,
{
{glm::quat(), glm::vec3(0.f, 0.f, 0.f), glm::vec3(), 0.f, 0},
{glm::quat(), glm::vec3(0.f, 1.f, 0.f), glm::vec3(), 1.0f, 1},
{glm::quat{1.0f,0.0f,0.0f,0.0f}, glm::vec3(0.f, 0.f, 0.f), glm::vec3(), 0.f, 0},
{glm::quat{1.0f,0.0f,0.0f,0.0f}, glm::vec3(0.f, 1.f, 0.f), glm::vec3(), 1.0f, 1},
}
};

View File

@ -9,7 +9,7 @@ BOOST_AUTO_TEST_CASE(test_vehicle_buoyancy) {
glm::vec2 tpos(-WATER_WORLD_SIZE / 2.f + 10.f);
{
VehicleObject* vehicle = Global::get().e->createVehicle(
90u, glm::vec3(tpos, 100.f), glm::quat());
90u, glm::vec3(tpos, 100.f), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);

View File

@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(test_activities) {
}
{
VehicleObject* vehicle = Global::get().e->createVehicle(
90u, glm::vec3(10.f, 0.f, 0.f), glm::quat());
90u, glm::vec3(10.f, 0.f, 0.f), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
BOOST_REQUIRE(vehicle->getModel() != nullptr);

View File

@ -12,7 +12,7 @@ BOOST_AUTO_TEST_CASE(instance_test_damage)
std::shared_ptr<ObjectData> object(new ObjectData);
InstanceObject inst(Global::get().e,
glm::vec3(0.f, 0.f, 0.f),
glm::quat(), nullptr,
glm::quat{1.0f,0.0f,0.0f,0.0f}, nullptr,
glm::vec3(1.f),
object, nullptr, nullptr
);
@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(instance_test_destroy)
std::shared_ptr<ObjectData> object(new ObjectData);
InstanceObject inst(Global::get().e,
glm::vec3(0.f, 0.f, 0.f),
glm::quat(), nullptr,
glm::quat{1.0f,0.0f,0.0f,0.0f}, nullptr,
glm::vec3(1.f),
object, nullptr, nullptr
);

View File

@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(test_available_nodes) {
{PathNode::EXTERNAL, -1, {-10.f, 10.f, 0.f}, 1.f, 0, 0},
}};
graph.createPathNodes(glm::vec3(), glm::quat(), path);
graph.createPathNodes(glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f}, path);
TrafficDirector director(&graph, Global::get().e);
@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(test_node_not_blocking) {
{PathNode::EXTERNAL, 1, {10.f, 10.f, 0.f}, 1.f, 0, 0},
}};
graph.createPathNodes(glm::vec3(), glm::quat(), path);
graph.createPathNodes(glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f}, path);
TrafficDirector director(&graph, Global::get().e);
@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(test_node_blocking) {
{PathNode::EXTERNAL, 1, {10.f, 10.f, 0.f}, 1.f, 0, 0},
}};
graph.createPathNodes(glm::vec3(), glm::quat(), path);
graph.createPathNodes(glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f}, path);
TrafficDirector director(&graph, Global::get().e);
@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(test_node_density) {
{PathNode::EXTERNAL, 1, {10.f, 10.f, 0.f}, 1.f, 0, 0},
}};
graph.createPathNodes(glm::vec3(), glm::quat(), path);
graph.createPathNodes(glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f}, path);
TrafficDirector director(&graph, Global::get().e);
@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(test_create_traffic) {
{PathNode::EXTERNAL, 1, {10.f, 10.f, 0.f}, 1.f, 0, 0},
}};
graph.createPathNodes(glm::vec3(), glm::quat(), path);
graph.createPathNodes(glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f}, path);
TrafficDirector director(&graph, Global::get().e);

View File

@ -8,7 +8,7 @@ BOOST_AUTO_TEST_SUITE(VehicleTests)
#if RW_TEST_WITH_DATA
BOOST_AUTO_TEST_CASE(test_create_vehicle) {
VehicleObject* vehicle =
Global::get().e->createVehicle(90u, glm::vec3(), glm::quat());
Global::get().e->createVehicle(90u, glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(test_create_vehicle) {
BOOST_AUTO_TEST_CASE(vehicle_parts) {
VehicleObject* vehicle =
Global::get().e->createVehicle(90u, glm::vec3(), glm::quat());
Global::get().e->createVehicle(90u, glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
BOOST_REQUIRE(vehicle->getModel() != nullptr);
@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(vehicle_parts) {
BOOST_AUTO_TEST_CASE(vehicle_part_vis) {
VehicleObject* vehicle =
Global::get().e->createVehicle(90u, glm::vec3(), glm::quat());
Global::get().e->createVehicle(90u, glm::vec3(), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
BOOST_REQUIRE(vehicle->getModel() != nullptr);
@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(vehicle_part_vis) {
BOOST_AUTO_TEST_CASE(test_door_position) {
VehicleObject* vehicle = Global::get().e->createVehicle(
90u, glm::vec3(10.f, 0.f, 0.f), glm::quat());
90u, glm::vec3(10.f, 0.f, 0.f), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(test_door_position) {
BOOST_AUTO_TEST_CASE(test_hinges) {
VehicleObject* vehicle = Global::get().e->createVehicle(
90u, glm::vec3(10.f, 0.f, 0.f), glm::quat());
90u, glm::vec3(10.f, 0.f, 0.f), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);
@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(test_hinges) {
BOOST_AUTO_TEST_CASE(test_open_part) {
VehicleObject* vehicle = Global::get().e->createVehicle(
90u, glm::vec3(10.f, 0.f, 0.f), glm::quat());
90u, glm::vec3(10.f, 0.f, 0.f), glm::quat{1.0f,0.0f,0.0f,0.0f});
BOOST_REQUIRE(vehicle != nullptr);