Some inner classes in particular were missed in the earlier pass.
Animation::Iterator::Iterator(const Animation &a):
animation(&a),
- event_iter(animation->events.begin()),
- end(false)
-{
-}
+ event_iter(animation->events.begin())
+{ }
Animation::Iterator &Animation::Iterator::operator+=(const Time::TimeDelta &t)
{
{ }
Animation::Loader::Loader(Animation &a, Collection *c):
- DataFile::CollectionObjectLoader<Animation>(a, c),
- start_slope(1),
- end_slope(1),
- slopes_set(0)
+ DataFile::CollectionObjectLoader<Animation>(a, c)
{
add("armature", &Animation::armature);
add("control_keyframe", &Loader::control_keyframe);
{
private:
Time::TimeDelta current_time;
- float start_slope;
- float end_slope;
- int slopes_set;
+ float start_slope = 1.0f;
+ float end_slope = 1.0f;
+ int slopes_set = 0;
public:
Loader(Animation &);
class MSPGL_API Iterator
{
private:
- const Animation *animation;
+ const Animation *animation = nullptr;
Time::TimeDelta elapsed;
std::vector<Event>::const_iterator event_iter;
- bool end;
+ bool end = false;
public:
Iterator(const Animation &);
AnimationPlayer::Target::Target(Placeable &p):
- placeable(p),
- object(nullptr),
- armature(nullptr),
- stacked(false)
+ placeable(p)
{ }
void AnimationPlayer::Target::animation_event(Placeable *, const string &name, const Variant &value)
private:
struct PlayingAnimation
{
- const Animation *animation;
- float speed;
+ const Animation *animation = nullptr;
+ float speed = 1.0f;
Animation::Iterator iterator;
PlayingAnimation(const Animation &, float);
struct Target: AnimationEventObserver
{
Placeable &placeable;
- AnimatedObject *object;
+ AnimatedObject *object = nullptr;
Matrix base_matrix;
- const Armature *armature;
+ const Armature *armature = nullptr;
std::vector<PlayingAnimation> animations;
- bool stacked;
+ bool stacked = false;
std::vector<AnimationEventObserver *> event_observers;
Target(Placeable &);
Armature::Link::Link(const string &n, unsigned i):
name(n),
- index(i),
- parent(nullptr)
+ index(i)
{ }
void Armature::Link::set_parent(const Link *p)
private:
std::string name;
- unsigned index;
- const Link *parent;
+ unsigned index = 0;
+ const Link *parent = nullptr;
Vector3 base;
public:
friend class OpenGLCommands;
protected:
- unsigned gl_prim_type;
- unsigned gl_index_type;
+ unsigned gl_prim_type = 0;
+ unsigned gl_index_type = 0;
OpenGLBatch(PrimitiveType);
Extension::Extension(const char *n, InitFunc f):
name(n),
- init_func(f),
- init_done(false),
- support(UNSUPPORTED)
+ init_func(f)
{ }
Extension::operator bool() const
typedef SupportLevel (*InitFunc)();
private:
- const char *name;
- InitFunc init_func;
- mutable bool init_done;
- mutable SupportLevel support;
+ const char *name = nullptr;
+ InitFunc init_func = nullptr;
+ mutable bool init_done = false;
+ mutable SupportLevel support = UNSUPPORTED;
public:
Extension(const char *, InitFunc);
MeshBuilder::MeshBuilder(Mesh &m):
PrimitiveBuilder(m.vertices),
- mesh(m),
- batch(nullptr)
+ mesh(m)
{ }
MeshBuilder::~MeshBuilder()
{
private:
Mesh &mesh;
- Batch *batch;
+ Batch *batch = nullptr;
public:
MeshBuilder(Mesh &);
PrimitiveBuilder::PrimitiveBuilder(VertexArray &a):
array(a),
- vab(array),
- in_batch(false),
- offs(0)
+ vab(array)
{ }
void PrimitiveBuilder::begin(PrimitiveType t)
VertexArray &array;
VertexArrayBuilder vab;
PrimitiveType type;
- bool in_batch;
- unsigned offs;
+ bool in_batch = false;
+ unsigned offs = 0;
PrimitiveBuilder(VertexArray &);
public:
Batch::Batch(PrimitiveType t):
BatchBackend(t),
- prim_type(t),
- index_type(VOID)
+ prim_type(t)
{
set_index_type(UNSIGNED_SHORT);
}
};
private:
- PrimitiveType prim_type;
- DataType index_type;
+ PrimitiveType prim_type = POINTS;
+ DataType index_type = VOID;
std::vector<std::uint8_t> data;
unsigned max_index = 0;
unsigned patch_size = 3;
Buffer::AsyncTransfer::AsyncTransfer(Buffer &b, size_t o, size_t s):
buffer(&b),
offset(o),
- size(s),
- dest_addr(nullptr)
+ size(s)
{
allocate();
}
QueryPool::QueryPool(QueryType t, unsigned s):
QueryPoolBackend(t),
- type(t),
- size(0)
+ type(t)
{
resize(s);
}
private:
QueryType type;
- unsigned size;
+ unsigned size = 0;
public:
QueryPool(QueryType type, unsigned);
Texture::Loader::Loader(Texture &t, Collection *c):
- CollectionObjectLoader<Texture>(t, c),
- levels(0)
+ CollectionObjectLoader<Texture>(t, c)
{
add("external_data", &Loader::external_data);
add("external_image", &Loader::external_image, false);
class MSPGL_API Loader: public DataFile::CollectionObjectLoader<Texture>
{
protected:
- unsigned levels;
+ unsigned levels = 0;
public:
Loader(Texture &t): Loader(t, nullptr) { }
}
-Sky::Planet::Planet():
- rayleigh_scatter(0.0f),
- mie_scatter(0.0f),
- mie_absorb(0.0f),
- ozone_absorb(0.0f),
- rayleigh_density_decay(1e3f),
- mie_density_decay(1e3f),
- ozone_band_center(1e4f),
- ozone_band_extent(1e2f),
- atmosphere_thickness(2e4f),
- planet_radius(1e6f),
- ground_albedo(0.2f)
-{ }
-
Sky::Planet Sky::Planet::earth()
{
Planet planet;
public:
struct MSPGL_API Planet
{
- Color rayleigh_scatter;
- Color mie_scatter;
- Color mie_absorb;
- Color ozone_absorb;
- float rayleigh_density_decay;
- float mie_density_decay;
- float ozone_band_center;
- float ozone_band_extent;
- float atmosphere_thickness;
- float planet_radius;
- Color ground_albedo;
-
- Planet();
+ Color rayleigh_scatter = { 0.0f };
+ Color mie_scatter = { 0.0f };
+ Color mie_absorb = { 0.0f };
+ Color ozone_absorb = { 0.0f };
+ float rayleigh_density_decay = 1e3f;
+ float mie_density_decay = 1e3f;
+ float ozone_band_center = 1e4f;
+ float ozone_band_extent = 1e2f;
+ float atmosphere_thickness = 2e4f;
+ float planet_radius = 1e6f;
+ Color ground_albedo = { 0.2f };
static Planet earth();
};
namespace SL {
ModuleCache::ModuleCache(DataFile::Collection *r):
- resources(r),
- next_source(1)
+ resources(r)
{ }
ModuleCache::ModuleCache(const ModuleCache &other)
private:
DataFile::Collection *resources;
std::map<std::string, Module *> modules;
- unsigned next_source;
+ unsigned next_source = 1;
public:
ModuleCache(DataFile::Collection *);
Parser::Parser(ModuleCache *s):
mod_cache(s),
- preprocessor(tokenizer),
- module(nullptr)
+ preprocessor(tokenizer)
{
tokenizer.signal_preprocess.connect(sigc::mem_fun(&preprocessor, &Preprocessor::preprocess));
preprocessor.signal_version.connect(sigc::mem_fun(this, &Parser::set_required_version));
class Parser
{
private:
- ModuleCache *mod_cache;
+ ModuleCache *mod_cache = nullptr;
std::string source;
- int base_index;
- int source_index;
+ int base_index = 0;
+ int source_index = 0;
Tokenizer tokenizer;
Preprocessor preprocessor;
- bool allow_stage_change;
- Module *module;
+ bool allow_stage_change = false;
+ Module *module = nullptr;
std::vector<const Module *> imported_modules;
- Stage *cur_stage;
+ Stage *cur_stage = nullptr;
std::set<std::string> global_types;
std::set<std::string> stage_types;
std::vector<std::string> errors;
}
-SpirVGenerator::TypeKey::TypeKey(BasicTypeDeclaration::Kind kind, bool sign):
- type_id(0)
+SpirVGenerator::TypeKey::TypeKey(BasicTypeDeclaration::Kind kind, bool sign)
{
switch(kind)
{
struct TypeKey
{
- Id type_id;
- unsigned detail;
+ Id type_id = 0;
+ unsigned detail = 0;
TypeKey(Id i, unsigned d): type_id(i), detail(d) { }
TypeKey(BasicTypeDeclaration::Kind, bool);
struct ConstantKey
{
- Id type_id;
+ Id type_id = 0;
union
{
int int_value;
namespace SL {
SpirVWriter::SpirVWriter(SpirVContent &c):
- content(c),
- op_target(nullptr),
- op_head_pos(0),
- current_block_id(0)
+ content(c)
{ }
void SpirVWriter::append(vector<Word> &target, const vector<Word> &source)
private:
SpirVContent &content;
- std::vector<Word> *op_target;
- unsigned op_head_pos;
- Id current_block_id;
+ std::vector<Word> *op_target = nullptr;
+ unsigned op_head_pos = 0;
+ Id current_block_id = 0;
public:
SpirVWriter(SpirVContent &);
ProgramData::SharedBlock::SharedBlock(ReflectData::LayoutHash h):
- block_hash(h),
- used(0),
- dirty(0),
- block(nullptr)
+ block_hash(h)
{
indices.type_flag = 0xFD;
}
ProgramData::ProgramBlock::ProgramBlock(ReflectData::LayoutHash h):
- prog_hash(h),
- bind_point(-1),
- block_index(-1)
+ prog_hash(h)
{
masks.used = ALL_ONES;
masks.dirty = ALL_ONES;
class ArrayLoader: public DataFile::Loader
{
private:
- DataType type;
- unsigned element_size;
+ DataType type = VOID;
+ unsigned element_size = 0;
std::vector<char> data;
public:
struct SharedBlock
{
- ReflectData::LayoutHash block_hash;
- Mask used;
- Mask dirty;
- UniformBlock *block;
+ ReflectData::LayoutHash block_hash = 0;
+ Mask used = 0;
+ Mask dirty = 0;
+ UniformBlock *block = nullptr;
union
{
std::uint8_t type_flag;
struct ProgramBlock
{
- ReflectData::LayoutHash prog_hash;
- int bind_point;
- int block_index;
+ ReflectData::LayoutHash prog_hash = 0;
+ int bind_point = -1;
+ int block_index = -1;
union
{
UniformBlock *block;
Sequence::Step::Step(Tag t, Renderable *r):
tag(t),
- lighting(nullptr),
renderable(r)
{ }
{
private:
Tag tag;
- const Lighting *lighting;
+ const Lighting *lighting = nullptr;
DepthTest depth_test;
StencilTest stencil_test;
Renderable *renderable;
}
-ResourceManager::ResourceLocation::ResourceLocation():
- collection(nullptr)
-{ }
-
ResourceManager::ResourceLocation::ResourceLocation(DataFile::Collection &c, const string &n):
collection(&c),
name(n)
ResourceManager::ManagedResource::ManagedResource(Resource &r):
resource(&r),
- load_priority(r.get_load_priority()),
- io(nullptr),
- loader(nullptr),
- state(NOT_LOADED),
- last_used(0),
- data_size(0)
+ load_priority(r.get_load_priority())
{ }
void ResourceManager::ManagedResource::start_loading()
ResourceManager::LoadingThread::LoadingThread():
Thread("ResourceManager"),
- sem(1),
- capacity(2),
- size(0),
- loaded_data_size(0),
- done(false)
+ sem(1)
{
launch();
}
struct ResourceLocation
{
- DataFile::Collection *collection;
+ DataFile::Collection *collection = nullptr;
std::string name;
- ResourceLocation();
+ ResourceLocation() = default;
ResourceLocation(DataFile::Collection &, const std::string &);
};
LOAD_ERROR
};
- Resource *resource;
+ Resource *resource = nullptr;
ResourceLocation location;
- int load_priority;
- IO::Seekable *io;
- Resource::AsyncLoader *loader;
- State state;
- unsigned last_used;
- std::uint64_t data_size;
+ int load_priority = 0;
+ IO::Seekable *io = nullptr;
+ Resource::AsyncLoader *loader = nullptr;
+ State state = NOT_LOADED;
+ unsigned last_used = 0;
+ std::uint64_t data_size = 0;
std::vector<ResourceObserver *> observers;
ManagedResource(Resource &);
Mutex queue_mutex;
std::deque<ManagedResource *> async_queue;
std::deque<ManagedResource *> sync_queue;
- unsigned capacity;
- unsigned size;
+ unsigned capacity = 2;
+ unsigned size = 0;
std::list<resource_load_error> error_queue;
Mutex data_size_mutex;
- std::uint64_t loaded_data_size;
- volatile bool done;
+ std::uint64_t loaded_data_size = 0;
+ volatile bool done = false;
public:
LoadingThread();
Resources *Resources::global_resources = nullptr;
-Resources::Resources(bool set_as_global):
- resource_manager(nullptr)
+Resources::Resources(bool set_as_global)
{
add_type<Animation>().suffix(".anim").keyword("animation");
add_type<Armature>().suffix(".arma").keyword("armature");
virtual void type(const DataFile::Symbol &);
};
- ResourceManager *resource_manager;
+ ResourceManager *resource_manager = nullptr;
static Resources *global_resources;
std::string source_fn;
std::vector<std::string> include_paths;
Msp::GL::SL::Features features;
- Msp::GL::SL::Compiler::Mode compile_mode;
+ Msp::GL::SL::Compiler::Mode compile_mode = Msp::GL::SL::Compiler::PROGRAM;
std::map<std::string, int> spec_values;
- bool parse_only;
- bool combined;
- Msp::GL::SL::Stage::Type stage;
- bool dump_ast;
+ bool parse_only = false;
+ bool combined = false;
+ Msp::GL::SL::Stage::Type stage = Msp::GL::SL::Stage::SHARED;
+ bool dump_ast = false;
std::string out_filename;
public:
using namespace Msp;
GlslCompiler::GlslCompiler(int argc, char **argv):
- features(GL::SL::Features::latest(GL::OPENGL)),
- compile_mode(GL::SL::Compiler::PROGRAM),
- parse_only(false),
- combined(false),
- stage(GL::SL::Stage::SHARED),
- dump_ast(false)
+ features(GL::SL::Features::latest(GL::OPENGL))
{
string stage_str;
vector<string> spec_values_in;
Input::Mouse mouse;
Resources resources;
GL::WindowView view;
- GL::Sequence *sequence;
- GL::Renderable *renderable;
- GL::AnimatedObject *anim_object;
- GL::AnimationPlayer *anim_player;
+ GL::Sequence *sequence = nullptr;
+ GL::Renderable *renderable = nullptr;
+ GL::AnimatedObject *anim_object = nullptr;
+ GL::AnimationPlayer *anim_player = nullptr;
GL::DirectionalLight light;
GL::Lighting lighting;
GL::Camera camera;
Geometry::Angle<float> yaw;
Geometry::Angle<float> pitch;
- float distance;
+ float distance = 10.0f;
Geometry::Angle<float> light_yaw;
Geometry::Angle<float> light_pitch;
- unsigned dragging;
+ unsigned dragging = 0;
Time::TimeStamp last_tick;
public:
window(display, opts.wnd_opts),
gl_device(window),
mouse(window),
- view(window),
- sequence(nullptr),
- renderable(nullptr),
- anim_object(nullptr),
- anim_player(nullptr),
- distance(10),
- dragging(0)
+ view(window)
{
for(list<string>::const_iterator i=opts.resource_locations.begin(); i!=opts.resource_locations.end(); ++i)
{