From 5b4b0178bd87a14c377ef1d3df7612e841e55e3f Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 10 Dec 2023 15:18:19 +0200 Subject: [PATCH] Add more default member initializers Some inner classes in particular were missed in the earlier pass. --- source/animation/animation.cpp | 11 +++-------- source/animation/animation.h | 10 +++++----- source/animation/animationplayer.cpp | 5 +---- source/animation/animationplayer.h | 10 +++++----- source/animation/armature.cpp | 3 +-- source/animation/armature.h | 4 ++-- source/backends/opengl/batch_backend.h | 4 ++-- source/backends/opengl/extension.cpp | 4 +--- source/backends/opengl/extension.h | 8 ++++---- source/builders/meshbuilder.cpp | 3 +-- source/builders/meshbuilder.h | 2 +- source/builders/primitivebuilder.cpp | 4 +--- source/builders/primitivebuilder.h | 4 ++-- source/core/batch.cpp | 3 +-- source/core/batch.h | 4 ++-- source/core/buffer.cpp | 3 +-- source/core/query.cpp | 3 +-- source/core/query.h | 2 +- source/core/texture.cpp | 3 +-- source/core/texture.h | 2 +- source/effects/sky.cpp | 14 -------------- source/effects/sky.h | 24 +++++++++++------------- source/glsl/modulecache.cpp | 3 +-- source/glsl/modulecache.h | 2 +- source/glsl/parser.cpp | 3 +-- source/glsl/parser.h | 12 ++++++------ source/glsl/spirv.cpp | 3 +-- source/glsl/spirv.h | 6 +++--- source/glsl/spirvwriter.cpp | 5 +---- source/glsl/spirvwriter.h | 6 +++--- source/materials/programdata.cpp | 9 ++------- source/materials/programdata.h | 18 +++++++++--------- source/render/sequence.cpp | 1 - source/render/sequence.h | 2 +- source/resources/resourcemanager.cpp | 17 ++--------------- source/resources/resourcemanager.h | 26 +++++++++++++------------- source/resources/resources.cpp | 3 +-- source/resources/resources.h | 2 +- tools/glslcompiler.cpp | 17 ++++++----------- tools/viewer.cpp | 20 +++++++------------- 40 files changed, 107 insertions(+), 178 deletions(-) diff --git a/source/animation/animation.cpp b/source/animation/animation.cpp index 1de1ff4e..a733e7c1 100644 --- a/source/animation/animation.cpp +++ b/source/animation/animation.cpp @@ -423,10 +423,8 @@ Animation::UniformInfo::UniformInfo(const string &n, unsigned s): 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) { @@ -495,10 +493,7 @@ Animation::Loader::Loader(Animation &a, Collection &c): { } Animation::Loader::Loader(Animation &a, Collection *c): - DataFile::CollectionObjectLoader(a, c), - start_slope(1), - end_slope(1), - slopes_set(0) + DataFile::CollectionObjectLoader(a, c) { add("armature", &Animation::armature); add("control_keyframe", &Loader::control_keyframe); diff --git a/source/animation/animation.h b/source/animation/animation.h index 997d0d93..8be5ff61 100644 --- a/source/animation/animation.h +++ b/source/animation/animation.h @@ -27,9 +27,9 @@ public: { 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 &); @@ -146,10 +146,10 @@ public: class MSPGL_API Iterator { private: - const Animation *animation; + const Animation *animation = nullptr; Time::TimeDelta elapsed; std::vector::const_iterator event_iter; - bool end; + bool end = false; public: Iterator(const Animation &); diff --git a/source/animation/animationplayer.cpp b/source/animation/animationplayer.cpp index 6da93d1c..de42364a 100644 --- a/source/animation/animationplayer.cpp +++ b/source/animation/animationplayer.cpp @@ -221,10 +221,7 @@ AnimationPlayer::PlayingAnimation::PlayingAnimation(const Animation &a, float s) 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) diff --git a/source/animation/animationplayer.h b/source/animation/animationplayer.h index eccd8bd3..7b8fd7ff 100644 --- a/source/animation/animationplayer.h +++ b/source/animation/animationplayer.h @@ -21,8 +21,8 @@ class MSPGL_API AnimationPlayer private: struct PlayingAnimation { - const Animation *animation; - float speed; + const Animation *animation = nullptr; + float speed = 1.0f; Animation::Iterator iterator; PlayingAnimation(const Animation &, float); @@ -31,11 +31,11 @@ private: struct Target: AnimationEventObserver { Placeable &placeable; - AnimatedObject *object; + AnimatedObject *object = nullptr; Matrix base_matrix; - const Armature *armature; + const Armature *armature = nullptr; std::vector animations; - bool stacked; + bool stacked = false; std::vector event_observers; Target(Placeable &); diff --git a/source/animation/armature.cpp b/source/animation/armature.cpp index 64e9dc44..5fb3403a 100644 --- a/source/animation/armature.cpp +++ b/source/animation/armature.cpp @@ -39,8 +39,7 @@ unsigned Armature::get_max_link_index() const Armature::Link::Link(const string &n, unsigned i): name(n), - index(i), - parent(nullptr) + index(i) { } void Armature::Link::set_parent(const Link *p) diff --git a/source/animation/armature.h b/source/animation/armature.h index 9476812f..262a2fb1 100644 --- a/source/animation/armature.h +++ b/source/animation/armature.h @@ -39,8 +39,8 @@ public: private: std::string name; - unsigned index; - const Link *parent; + unsigned index = 0; + const Link *parent = nullptr; Vector3 base; public: diff --git a/source/backends/opengl/batch_backend.h b/source/backends/opengl/batch_backend.h index 183db91c..ed882577 100644 --- a/source/backends/opengl/batch_backend.h +++ b/source/backends/opengl/batch_backend.h @@ -13,8 +13,8 @@ class MSPGL_API OpenGLBatch friend class OpenGLCommands; protected: - unsigned gl_prim_type; - unsigned gl_index_type; + unsigned gl_prim_type = 0; + unsigned gl_index_type = 0; OpenGLBatch(PrimitiveType); diff --git a/source/backends/opengl/extension.cpp b/source/backends/opengl/extension.cpp index a650b650..c14f4cfc 100644 --- a/source/backends/opengl/extension.cpp +++ b/source/backends/opengl/extension.cpp @@ -36,9 +36,7 @@ namespace GL { Extension::Extension(const char *n, InitFunc f): name(n), - init_func(f), - init_done(false), - support(UNSUPPORTED) + init_func(f) { } Extension::operator bool() const diff --git a/source/backends/opengl/extension.h b/source/backends/opengl/extension.h index 27dae6fc..f1edec3e 100644 --- a/source/backends/opengl/extension.h +++ b/source/backends/opengl/extension.h @@ -31,10 +31,10 @@ public: 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); diff --git a/source/builders/meshbuilder.cpp b/source/builders/meshbuilder.cpp index 395827a4..a8a47117 100644 --- a/source/builders/meshbuilder.cpp +++ b/source/builders/meshbuilder.cpp @@ -8,8 +8,7 @@ namespace GL { MeshBuilder::MeshBuilder(Mesh &m): PrimitiveBuilder(m.vertices), - mesh(m), - batch(nullptr) + mesh(m) { } MeshBuilder::~MeshBuilder() diff --git a/source/builders/meshbuilder.h b/source/builders/meshbuilder.h index ff52ee68..082db774 100644 --- a/source/builders/meshbuilder.h +++ b/source/builders/meshbuilder.h @@ -14,7 +14,7 @@ class MSPGL_API MeshBuilder: public PrimitiveBuilder { private: Mesh &mesh; - Batch *batch; + Batch *batch = nullptr; public: MeshBuilder(Mesh &); diff --git a/source/builders/primitivebuilder.cpp b/source/builders/primitivebuilder.cpp index 85c695c3..9c08eb82 100644 --- a/source/builders/primitivebuilder.cpp +++ b/source/builders/primitivebuilder.cpp @@ -8,9 +8,7 @@ namespace GL { PrimitiveBuilder::PrimitiveBuilder(VertexArray &a): array(a), - vab(array), - in_batch(false), - offs(0) + vab(array) { } void PrimitiveBuilder::begin(PrimitiveType t) diff --git a/source/builders/primitivebuilder.h b/source/builders/primitivebuilder.h index 74987cfc..83eb98d7 100644 --- a/source/builders/primitivebuilder.h +++ b/source/builders/primitivebuilder.h @@ -23,8 +23,8 @@ protected: VertexArray &array; VertexArrayBuilder vab; PrimitiveType type; - bool in_batch; - unsigned offs; + bool in_batch = false; + unsigned offs = 0; PrimitiveBuilder(VertexArray &); public: diff --git a/source/core/batch.cpp b/source/core/batch.cpp index 56c25efb..6089b463 100644 --- a/source/core/batch.cpp +++ b/source/core/batch.cpp @@ -46,8 +46,7 @@ namespace GL { Batch::Batch(PrimitiveType t): BatchBackend(t), - prim_type(t), - index_type(VOID) + prim_type(t) { set_index_type(UNSIGNED_SHORT); } diff --git a/source/core/batch.h b/source/core/batch.h index 0bd176d0..fec3998c 100644 --- a/source/core/batch.h +++ b/source/core/batch.h @@ -34,8 +34,8 @@ public: }; private: - PrimitiveType prim_type; - DataType index_type; + PrimitiveType prim_type = POINTS; + DataType index_type = VOID; std::vector data; unsigned max_index = 0; unsigned patch_size = 3; diff --git a/source/core/buffer.cpp b/source/core/buffer.cpp index ae72f78c..f076032b 100644 --- a/source/core/buffer.cpp +++ b/source/core/buffer.cpp @@ -78,8 +78,7 @@ bool Buffer::unmap() Buffer::AsyncTransfer::AsyncTransfer(Buffer &b, size_t o, size_t s): buffer(&b), offset(o), - size(s), - dest_addr(nullptr) + size(s) { allocate(); } diff --git a/source/core/query.cpp b/source/core/query.cpp index 13b62801..667f1465 100644 --- a/source/core/query.cpp +++ b/source/core/query.cpp @@ -6,8 +6,7 @@ namespace GL { QueryPool::QueryPool(QueryType t, unsigned s): QueryPoolBackend(t), - type(t), - size(0) + type(t) { resize(s); } diff --git a/source/core/query.h b/source/core/query.h index 0485761b..13e1a7db 100644 --- a/source/core/query.h +++ b/source/core/query.h @@ -38,7 +38,7 @@ public: private: QueryType type; - unsigned size; + unsigned size = 0; public: QueryPool(QueryType type, unsigned); diff --git a/source/core/texture.cpp b/source/core/texture.cpp index 407333e1..3c5e58aa 100644 --- a/source/core/texture.cpp +++ b/source/core/texture.cpp @@ -102,8 +102,7 @@ Texture::GenericLoader::TypeRegistry &Texture::get_texture_registry() Texture::Loader::Loader(Texture &t, Collection *c): - CollectionObjectLoader(t, c), - levels(0) + CollectionObjectLoader(t, c) { add("external_data", &Loader::external_data); add("external_image", &Loader::external_image, false); diff --git a/source/core/texture.h b/source/core/texture.h index 777845b2..c567f4cc 100644 --- a/source/core/texture.h +++ b/source/core/texture.h @@ -35,7 +35,7 @@ protected: class MSPGL_API Loader: public DataFile::CollectionObjectLoader { protected: - unsigned levels; + unsigned levels = 0; public: Loader(Texture &t): Loader(t, nullptr) { } diff --git a/source/effects/sky.cpp b/source/effects/sky.cpp index 94ca90fe..1d1699db 100644 --- a/source/effects/sky.cpp +++ b/source/effects/sky.cpp @@ -165,20 +165,6 @@ void Sky::set_debug_name(const string &name) } -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; diff --git a/source/effects/sky.h b/source/effects/sky.h index 043ce74c..9819e4f8 100644 --- a/source/effects/sky.h +++ b/source/effects/sky.h @@ -29,19 +29,17 @@ class MSPGL_API Sky: public Effect 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(); }; diff --git a/source/glsl/modulecache.cpp b/source/glsl/modulecache.cpp index a0686902..ef864dc0 100644 --- a/source/glsl/modulecache.cpp +++ b/source/glsl/modulecache.cpp @@ -10,8 +10,7 @@ namespace GL { namespace SL { ModuleCache::ModuleCache(DataFile::Collection *r): - resources(r), - next_source(1) + resources(r) { } ModuleCache::ModuleCache(const ModuleCache &other) diff --git a/source/glsl/modulecache.h b/source/glsl/modulecache.h index ba892f93..91f6a5e5 100644 --- a/source/glsl/modulecache.h +++ b/source/glsl/modulecache.h @@ -13,7 +13,7 @@ class ModuleCache private: DataFile::Collection *resources; std::map modules; - unsigned next_source; + unsigned next_source = 1; public: ModuleCache(DataFile::Collection *); diff --git a/source/glsl/parser.cpp b/source/glsl/parser.cpp index 907cb7fe..a9962afe 100644 --- a/source/glsl/parser.cpp +++ b/source/glsl/parser.cpp @@ -18,8 +18,7 @@ namespace SL { 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)); diff --git a/source/glsl/parser.h b/source/glsl/parser.h index d1dd379d..d46afcdc 100644 --- a/source/glsl/parser.h +++ b/source/glsl/parser.h @@ -17,16 +17,16 @@ class ModuleCache; 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 imported_modules; - Stage *cur_stage; + Stage *cur_stage = nullptr; std::set global_types; std::set stage_types; std::vector errors; diff --git a/source/glsl/spirv.cpp b/source/glsl/spirv.cpp index 88ab30b9..ce8da1ed 100644 --- a/source/glsl/spirv.cpp +++ b/source/glsl/spirv.cpp @@ -2085,8 +2085,7 @@ void SpirVGenerator::visit(Jump &jump) } -SpirVGenerator::TypeKey::TypeKey(BasicTypeDeclaration::Kind kind, bool sign): - type_id(0) +SpirVGenerator::TypeKey::TypeKey(BasicTypeDeclaration::Kind kind, bool sign) { switch(kind) { diff --git a/source/glsl/spirv.h b/source/glsl/spirv.h index 8436cf14..8e6589b9 100644 --- a/source/glsl/spirv.h +++ b/source/glsl/spirv.h @@ -45,8 +45,8 @@ private: 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); @@ -56,7 +56,7 @@ private: struct ConstantKey { - Id type_id; + Id type_id = 0; union { int int_value; diff --git a/source/glsl/spirvwriter.cpp b/source/glsl/spirvwriter.cpp index c73b725a..4f9e29be 100644 --- a/source/glsl/spirvwriter.cpp +++ b/source/glsl/spirvwriter.cpp @@ -8,10 +8,7 @@ namespace GL { 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 &target, const vector &source) diff --git a/source/glsl/spirvwriter.h b/source/glsl/spirvwriter.h index 8456389a..6cad9460 100644 --- a/source/glsl/spirvwriter.h +++ b/source/glsl/spirvwriter.h @@ -37,9 +37,9 @@ public: private: SpirVContent &content; - std::vector *op_target; - unsigned op_head_pos; - Id current_block_id; + std::vector *op_target = nullptr; + unsigned op_head_pos = 0; + Id current_block_id = 0; public: SpirVWriter(SpirVContent &); diff --git a/source/materials/programdata.cpp b/source/materials/programdata.cpp index ac63585e..e8cec667 100644 --- a/source/materials/programdata.cpp +++ b/source/materials/programdata.cpp @@ -715,10 +715,7 @@ void ProgramData::set_debug_name(const string &name) ProgramData::SharedBlock::SharedBlock(ReflectData::LayoutHash h): - block_hash(h), - used(0), - dirty(0), - block(nullptr) + block_hash(h) { indices.type_flag = 0xFD; } @@ -730,9 +727,7 @@ const uint8_t *ProgramData::SharedBlock::get_uniform_indices() const 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; diff --git a/source/materials/programdata.h b/source/materials/programdata.h index 41121e44..d0229b34 100644 --- a/source/materials/programdata.h +++ b/source/materials/programdata.h @@ -68,8 +68,8 @@ private: class ArrayLoader: public DataFile::Loader { private: - DataType type; - unsigned element_size; + DataType type = VOID; + unsigned element_size = 0; std::vector data; public: @@ -111,10 +111,10 @@ private: 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; @@ -133,9 +133,9 @@ private: 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; diff --git a/source/render/sequence.cpp b/source/render/sequence.cpp index 6fe2cc08..582e63e9 100644 --- a/source/render/sequence.cpp +++ b/source/render/sequence.cpp @@ -182,7 +182,6 @@ void Sequence::set_debug_name(const string &name) Sequence::Step::Step(Tag t, Renderable *r): tag(t), - lighting(nullptr), renderable(r) { } diff --git a/source/render/sequence.h b/source/render/sequence.h index 805aa9e0..0c7c869c 100644 --- a/source/render/sequence.h +++ b/source/render/sequence.h @@ -42,7 +42,7 @@ public: { private: Tag tag; - const Lighting *lighting; + const Lighting *lighting = nullptr; DepthTest depth_test; StencilTest stencil_test; Renderable *renderable; diff --git a/source/resources/resourcemanager.cpp b/source/resources/resourcemanager.cpp index af780bf0..a2023f5d 100644 --- a/source/resources/resourcemanager.cpp +++ b/source/resources/resourcemanager.cpp @@ -283,10 +283,6 @@ bool ResourceManager::age_order(ManagedResource *mr1, ManagedResource *mr2) } -ResourceManager::ResourceLocation::ResourceLocation(): - collection(nullptr) -{ } - ResourceManager::ResourceLocation::ResourceLocation(DataFile::Collection &c, const string &n): collection(&c), name(n) @@ -295,12 +291,7 @@ ResourceManager::ResourceLocation::ResourceLocation(DataFile::Collection &c, con 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() @@ -381,11 +372,7 @@ void ResourceManager::ManagedResource::remove_observer(ResourceObserver &w) ResourceManager::LoadingThread::LoadingThread(): Thread("ResourceManager"), - sem(1), - capacity(2), - size(0), - loaded_data_size(0), - done(false) + sem(1) { launch(); } diff --git a/source/resources/resourcemanager.h b/source/resources/resourcemanager.h index 4aac2eb3..1e6fcbc3 100644 --- a/source/resources/resourcemanager.h +++ b/source/resources/resourcemanager.h @@ -36,10 +36,10 @@ public: struct ResourceLocation { - DataFile::Collection *collection; + DataFile::Collection *collection = nullptr; std::string name; - ResourceLocation(); + ResourceLocation() = default; ResourceLocation(DataFile::Collection &, const std::string &); }; @@ -56,14 +56,14 @@ private: 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 observers; ManagedResource(Resource &); @@ -85,12 +85,12 @@ private: Mutex queue_mutex; std::deque async_queue; std::deque sync_queue; - unsigned capacity; - unsigned size; + unsigned capacity = 2; + unsigned size = 0; std::list 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(); diff --git a/source/resources/resources.cpp b/source/resources/resources.cpp index 0239bd16..ec17ec86 100644 --- a/source/resources/resources.cpp +++ b/source/resources/resources.cpp @@ -44,8 +44,7 @@ void init_builtin_data(DataFile::BuiltinSource &); Resources *Resources::global_resources = nullptr; -Resources::Resources(bool set_as_global): - resource_manager(nullptr) +Resources::Resources(bool set_as_global) { add_type().suffix(".anim").keyword("animation"); add_type().suffix(".arma").keyword("armature"); diff --git a/source/resources/resources.h b/source/resources/resources.h index cf9ad9f2..ff2bcd5f 100644 --- a/source/resources/resources.h +++ b/source/resources/resources.h @@ -83,7 +83,7 @@ private: virtual void type(const DataFile::Symbol &); }; - ResourceManager *resource_manager; + ResourceManager *resource_manager = nullptr; static Resources *global_resources; diff --git a/tools/glslcompiler.cpp b/tools/glslcompiler.cpp index dd5a6c6a..48e003b9 100644 --- a/tools/glslcompiler.cpp +++ b/tools/glslcompiler.cpp @@ -26,12 +26,12 @@ private: std::string source_fn; std::vector 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 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: @@ -44,12 +44,7 @@ using namespace std; 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 spec_values_in; diff --git a/tools/viewer.cpp b/tools/viewer.cpp index 0753ae25..8ac41a23 100644 --- a/tools/viewer.cpp +++ b/tools/viewer.cpp @@ -69,19 +69,19 @@ private: 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 yaw; Geometry::Angle pitch; - float distance; + float distance = 10.0f; Geometry::Angle light_yaw; Geometry::Angle light_pitch; - unsigned dragging; + unsigned dragging = 0; Time::TimeStamp last_tick; public: @@ -134,13 +134,7 @@ Viewer::Viewer(int argc, char **argv): 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::const_iterator i=opts.resource_locations.begin(); i!=opts.resource_locations.end(); ++i) { -- 2.45.2