]> git.tdb.fi Git - libs/gl.git/commitdiff
Use default member initializers for simple types
authorMikko Rasa <tdb@tdb.fi>
Sat, 9 Oct 2021 11:11:09 +0000 (14:11 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 9 Oct 2021 11:41:59 +0000 (14:41 +0300)
Also mark special member functions as defaulted instead of defining them
as empty.

151 files changed:
source/animation/animation.cpp
source/animation/animation.h
source/animation/animationeventobserver.h
source/animation/keyframe.cpp
source/animation/keyframe.h
source/animation/pose.cpp
source/animation/pose.h
source/animation/transform.cpp
source/animation/transform.h
source/backends/opengl/buffer_backend.h
source/backends/opengl/commands_backend.cpp
source/backends/opengl/commands_backend.h
source/backends/opengl/program_backend.cpp
source/backends/opengl/program_backend.h
source/backends/opengl/sampler_backend.h
source/backends/opengl/texture_backend.cpp
source/backends/opengl/texture_backend.h
source/builders/font.cpp
source/builders/font.h
source/builders/geometrybuilder.cpp
source/builders/geometrybuilder.h
source/builders/sequencetemplate.cpp
source/builders/sequencetemplate.h
source/builders/vertexbuilder.h
source/core/backend.cpp
source/core/backend.h
source/core/blend.cpp
source/core/blend.h
source/core/buffer.cpp
source/core/buffer.h
source/core/bufferable.cpp
source/core/bufferable.h
source/core/clipplane.cpp
source/core/clipplane.h
source/core/color.h
source/core/depthtest.cpp
source/core/depthtest.h
source/core/framebuffer.cpp
source/core/framebuffer.h
source/core/frameformat.cpp
source/core/frameformat.h
source/core/mesh.cpp
source/core/mesh.h
source/core/module.cpp
source/core/module.h
source/core/pipelinestate.cpp
source/core/pipelinestate.h
source/core/program.h
source/core/rect.h
source/core/reflectdata.cpp
source/core/reflectdata.h
source/core/sampler.cpp
source/core/sampler.h
source/core/stenciltest.cpp
source/core/stenciltest.h
source/core/tag.h
source/core/texture1d.cpp
source/core/texture1d.h
source/core/texture2d.cpp
source/core/texture2d.h
source/core/texture2dmultisample.cpp
source/core/texture2dmultisample.h
source/core/texture3d.cpp
source/core/texture3d.h
source/core/texturecube.cpp
source/core/texturecube.h
source/core/vertexarray.cpp
source/core/vertexarray.h
source/core/vertexformat.cpp
source/core/vertexformat.h
source/core/vertexsetup.cpp
source/core/vertexsetup.h
source/effects/ambientocclusion.cpp
source/effects/ambientocclusion.h
source/effects/bloom.cpp
source/effects/bloom.h
source/effects/colorcurve.cpp
source/effects/colorcurve.h
source/effects/environmentmap.cpp
source/effects/environmentmap.h
source/effects/postprocessor.cpp
source/effects/postprocessor.h
source/effects/shadowmap.cpp
source/effects/shadowmap.h
source/glsl/compiler.cpp
source/glsl/compiler.h
source/glsl/features.cpp
source/glsl/features.h
source/glsl/finalize.cpp
source/glsl/finalize.h
source/glsl/generate.cpp
source/glsl/generate.h
source/glsl/glsl_error.cpp
source/glsl/glsl_error.h
source/glsl/optimize.cpp
source/glsl/optimize.h
source/glsl/output.cpp
source/glsl/output.h
source/glsl/reflect.cpp
source/glsl/reflect.h
source/glsl/resolve.cpp
source/glsl/resolve.h
source/glsl/sourcemap.cpp
source/glsl/sourcemap.h
source/glsl/spirv.cpp
source/glsl/spirv.h
source/glsl/syntax.cpp
source/glsl/syntax.h
source/glsl/tokenizer.cpp
source/glsl/tokenizer.h
source/glsl/validate.cpp
source/glsl/validate.h
source/glsl/visitor.cpp
source/glsl/visitor.h
source/materials/directionallight.cpp
source/materials/directionallight.h
source/materials/light.cpp
source/materials/light.h
source/materials/material.h
source/materials/pointlight.cpp
source/materials/pointlight.h
source/materials/rendermethod.cpp
source/materials/rendermethod.h
source/materials/unlitmaterial.cpp
source/materials/unlitmaterial.h
source/render/camera.cpp
source/render/camera.h
source/render/object.cpp
source/render/object.h
source/render/occludedscene.cpp
source/render/occludedscene.h
source/render/placeable.h
source/render/programdata.cpp
source/render/programdata.h
source/render/renderable.h
source/render/renderer.cpp
source/render/renderer.h
source/render/scene.h
source/render/sequence.cpp
source/render/sequence.h
source/render/slot.cpp
source/render/slot.h
source/render/text.cpp
source/render/text.h
source/render/zsortedscene.cpp
source/render/zsortedscene.h
source/resources/resource.cpp
source/resources/resource.h
source/resources/resourcemanager.cpp
source/resources/resourcemanager.h
source/resources/resourceobserver.h

index 98cfdc87f5398f2813252fb9c0688fdbd69be65a..76d9552e1771530945f6f7bba02f79b70064b979 100644 (file)
@@ -16,11 +16,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Animation::Animation():
-       armature(0),
-       looping(false)
-{ }
-
 Animation::~Animation()
 {
        for(TimedKeyFrame &k: keyframes)
index eb5911c32a4d08a6c441cabddbd56231aa05f56d..7d55bb61b7be33e01c7ed851fe08111784ad15b6 100644 (file)
@@ -163,16 +163,15 @@ public:
        };
 
 private:
-       const Armature *armature;
+       const Armature *armature = 0;
        std::vector<TimedKeyFrame> keyframes;
        std::vector<Event> events;
-       bool looping;
+       bool looping = false;
        std::vector<UniformInfo> uniforms;
        std::vector<Curve *> curves;
-       unsigned uniform_curve_offset;
+       unsigned uniform_curve_offset = 0;
 
 public:
-       Animation();
        ~Animation();
 
        void set_armature(const Armature &);
index 1eafc4d206c89c32b20245300043c154fcee10ee..b1d57e97ad8bfb56192047093f3ff216665417a4 100644 (file)
@@ -12,9 +12,9 @@ class Placeable;
 class AnimationEventObserver
 {
 protected:
-       AnimationEventObserver() { }
+       AnimationEventObserver() = default;
 public:
-       virtual ~AnimationEventObserver() { }
+       virtual ~AnimationEventObserver() = default;
 
        virtual void animation_event(Placeable *, const std::string &, const Variant &) { }
 };
index 3f3dea28f0d1412d0a0414cfc9384e1ef5993c9a..d1f1a7ea298251818b60d2b4c401edd0f0b07a91 100644 (file)
@@ -8,13 +8,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-// Avoid synthesizing RefPtr c'tor and d'tor in files including keyframe.h
-KeyFrame::KeyFrame()
-{ }
-
-KeyFrame::~KeyFrame()
-{ }
-
 void KeyFrame::set_transform(const Transform &t)
 {
        transform = t;
index 26d18534496b755ceac151601b886b589fad8da3..5e70aa730c970bf11ac51231c72ad8defd695344 100644 (file)
@@ -67,12 +67,9 @@ public:
 private:
        Transform transform;
        UniformMap uniforms;
-       const Pose *pose;
+       const Pose *pose = 0;
 
 public:
-       KeyFrame();
-       ~KeyFrame();
-
        void set_transform(const Transform &);
        void set_matrix(const Matrix &);
        void set_uniform(const std::string &, const AnimatedUniform &);
index 99fa6bb3dfe812265a8e2372ddd9c1daad5f887a..2faecad3110437c2a2ae918800755c3c49716d14 100644 (file)
@@ -8,12 +8,7 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Pose::Pose():
-       armature(0)
-{ }
-
-Pose::Pose(const Armature &a):
-       armature(0)
+Pose::Pose(const Armature &a)
 {
        set_armature(a);
 }
index cbd8137bc4b861f5ccdb7d3e9b0411e754c57faa..d0c127edc9eaaf4b7d03744c93d5723988701018 100644 (file)
@@ -40,11 +40,11 @@ private:
                void rotation(float, float, float, float);
        };
 
-       const Armature *armature;
+       const Armature *armature = 0;
        std::vector<Link> links;
 
 public:
-       Pose();
+       Pose() = default;
        Pose(const Armature &);
 
        void set_armature(const Armature &);
index b703a5b12e345863c03c533f782adcfa4e5b33be..4c8e15643774f3bae9cb05ff1b82227d6aa7a783 100644 (file)
@@ -3,13 +3,6 @@
 namespace Msp {
 namespace GL {
 
-Transform::Transform():
-       position(0.0f, 0.0f, 0.0f),
-       euler(Angle::zero(), Angle::zero(), Angle::zero()),
-       scale(1.0f, 1.0f, 1.0f),
-       mask(NONE)
-{ }
-
 Transform Transform::from_matrix(const Matrix &matrix)
 {
        Transform trn;
index 1d0aedddf71b3fe900ffc2b7689008759ef3939e..5854c4175e2e023b17ed7ad88b56f490a733ea0b 100644 (file)
@@ -60,12 +60,10 @@ public:
 private:
        Vector3 position;
        AngleVector3 euler;
-       Vector3 scale;
-       ComponentMask mask;
+       Vector3 scale = { 1.0f, 1.0f, 1.0f };
+       ComponentMask mask = NONE;
 
 public:
-       Transform();
-
        static Transform from_matrix(const Matrix &);
 
        void set_position(const Vector3 &);
index 7162a26b673fcd9d0bf2ce9e70b781ab93971c8c..5db516fb85b0a4cee8de181ee9ea7224206c8337 100644 (file)
@@ -13,7 +13,7 @@ class OpenGLBuffer: public NonCopyable
        friend class OpenGLVertexSetup;
 
 protected:
-       unsigned id;
+       unsigned id = 0;
 
        static OpenGLBuffer *scratch_binding;
 
index e9fa8b7c02d011f1ebd4d29f006ef29f8b0f314f..adecd5c87bc71baeb9059332dc57b1535d8b8403 100644 (file)
@@ -18,10 +18,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-OpenGLCommands::OpenGLCommands():
-       pipeline_state(0)
-{ }
-
 void OpenGLCommands::use_pipeline(const PipelineState *ps)
 {
        pipeline_state = ps;
index f54b27a11c1947cd3fd2e2e357a43b488a677b3d..0fe989a730256127ba45bf00b6e8ccb2e42582a8 100644 (file)
@@ -13,9 +13,9 @@ class QueryPool;
 class OpenGLCommands
 {
 protected:
-       const PipelineState *pipeline_state;
+       const PipelineState *pipeline_state = 0;
 
-       OpenGLCommands();
+       OpenGLCommands() = default;
 
        void use_pipeline(const PipelineState *);
        void clear(const ClearValue *);
index 3b1c4293326fd1edfe21e3aa7806e2dde4597df0..4dbf38a7197e5bd40e58f1f5c4151bbfafe2a594 100644 (file)
@@ -38,13 +38,11 @@ void uniform_matrix_wrapper(unsigned index, unsigned count, const void *data)
 namespace Msp {
 namespace GL {
 
-OpenGLProgram::OpenGLProgram():
-       linked(false)
+OpenGLProgram::OpenGLProgram()
 {
        static Require _req(ARB_shader_objects);
 
        id = glCreateProgram();
-       fill(stage_ids, stage_ids+MAX_STAGES, 0);
 }
 
 OpenGLProgram::~OpenGLProgram()
index 4ae729e2c95525cc2ef8e102991d0bc25e464632..95df989173df059f7ec59434d2ab56cd275fdca6 100644 (file)
@@ -40,9 +40,9 @@ protected:
                UniformCall(unsigned l, unsigned s, FuncPtr f): location(l), size(s), func(f) { }
        };
 
-       unsigned id;
-       unsigned stage_ids[MAX_STAGES];
-       bool linked;
+       unsigned id = 0;
+       unsigned stage_ids[MAX_STAGES] = { };
+       bool linked = false;
        std::vector<UniformCall> uniform_calls;
        std::string debug_name;
 
index 77590c254b000c0d50b6e0c28fd6a901f6789db1..20ad4b6c262a252683ba38fb1aa3f682b71264b0 100644 (file)
@@ -9,7 +9,7 @@ class OpenGLSampler
        friend class OpenGLPipelineState;
 
 protected:
-       unsigned id;
+       unsigned id = 0;
 
        OpenGLSampler();
 
index e8288045f4625fd5766e5b1048809717660ce204..88e1c2b33877cc1349b93375b8201f4de318047c 100644 (file)
@@ -23,7 +23,6 @@ int OpenGLTexture::swizzle_orders[] =
 OpenGLTexture *OpenGLTexture::scratch_binding = 0;
 
 OpenGLTexture::OpenGLTexture(unsigned t):
-       id(0),
        target(t)
 {
        static bool alignment_init = false;
index 815778203bcaba66f4e13de3f81a2b08aa8450a0..a18b7bf8412d7427b17586982c3418b5408e3780 100644 (file)
@@ -12,7 +12,7 @@ class OpenGLTexture: public NonCopyable
        friend class OpenGLPipelineState;
 
 protected:
-       unsigned id;
+       unsigned id = 0;
        unsigned target;
        std::string debug_name;
 
index 4fb643527c83d9ea43058ffb81ead0332a74941e..58b23fe9dac150cefb9f0212c7b7777cba8584a3 100644 (file)
@@ -10,18 +10,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Font::Font():
-       native_size(1),
-       ascent(1),
-       descent(0),
-       cap_height(1),
-       x_height(0.5)
-{ }
-
-// Avoid synthesizing ~RefPtr in files including font.h
-Font::~Font()
-{ }
-
 void Font::set_texture(const Texture2D &t)
 {
        texture = &t;
@@ -129,20 +117,6 @@ unsigned Font::get_ligature(unsigned code, unsigned next) const
 }
 
 
-Font::Glyph::Glyph():
-       code(0),
-       x1(0),
-       y1(0),
-       x2(1),
-       y2(1),
-       w(1),
-       h(1),
-       off_x(0),
-       off_y(0),
-       advance(1)
-{ }
-
-
 Font::Loader::Loader(Font &f, Collection &c):
        DataFile::CollectionObjectLoader<Font>(f, &c)
 {
index f46a287092f811a8a6c2b89a73b1aee0eaf97af4..adbfc82830c9d5ae69ff7f0e0cea0c893c21978e 100644 (file)
@@ -41,14 +41,16 @@ public:
                        void texcoords(float, float, float, float);
                };
 
-               unsigned code;
-               float x1, y1;
-               float x2, y2;
-               float w, h;
-               float off_x, off_y;
-               float advance;
-
-               Glyph();
+               unsigned code = 0;
+               float x1 = 0.0f;
+               float y1 = 0.0f;
+               float x2 = 1.0f;
+               float y2 = 1.0f;
+               float w = 1.0f;
+               float h = 1.0f;
+               float off_x = 0.0f;
+               float off_y = 0.0f;
+               float advance = 1.0f;
        };
 
 private:
@@ -57,20 +59,17 @@ private:
        typedef std::map<CodePair, float> KerningMap;
        typedef std::map<CodePair, unsigned> LigatureMap;
 
-       const Texture2D *texture;
-       float native_size;
-       float ascent;
-       float descent;
-       float cap_height;
-       float x_height;
+       const Texture2D *texture = 0;
+       float native_size = 1.0f;
+       float ascent = 1.0f;
+       float descent = 0.0f;
+       float cap_height = 1.0f;
+       float x_height = 0.5f;
        GlyphMap glyphs;
        KerningMap kerning;
        LigatureMap ligatures;
 
 public:
-       Font();
-       ~Font();
-
        void set_texture(const Texture2D &);
        const Texture2D &get_texture() const;
 
index 8e0ae53bbf2dda7f842373c5f8c6f1c72b97d81d..52d05fae350d299f10f121669388f61f15186522 100644 (file)
@@ -4,11 +4,6 @@
 namespace Msp {
 namespace GL {
 
-GeometryBuilder::GeometryBuilder():
-       generate_tan(false),
-       tex_fit(STRETCH)
-{ }
-
 GeometryBuilder &GeometryBuilder::tangents(bool t)
 {
        generate_tan = t;
index 87dd4e22bfcbb060a6d38095f85b0fbfdb64358a..04b262519a8f4075310d04f0eb17cb5f031daa4f 100644 (file)
@@ -20,10 +20,10 @@ public:
        };
 
 protected:
-       bool generate_tan;
-       TextureFit tex_fit;
+       bool generate_tan = false;
+       TextureFit tex_fit = STRETCH;
 
-       GeometryBuilder();
+       GeometryBuilder() = default;
 
 public:
        DEPRECATED GeometryBuilder &tbn(bool t = true) { return tangents(t); }
index 5d7f4d0b2104caf5474bbd2155677e5bf95c0736..e8e451fc9a54d78a5b6d1d1bfc415a64ffef90be 100644 (file)
@@ -16,16 +16,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-SequenceTemplate::SequenceTemplate():
-       hdr(false),
-       alpha(false),
-       required_multisample(0),
-       max_multisample(0),
-       clear_enabled(false),
-       clear_depth(1.0f),
-       clear_stencil(0)
-{ }
-
 SequenceTemplate::~SequenceTemplate()
 {
        for(const PostProcessor &p: postprocessors)
@@ -48,10 +38,6 @@ SequenceTemplate::PostProcessorRegistry &SequenceTemplate::get_postprocessor_reg
 }
 
 
-SequenceTemplate::Step::~Step()
-{ }
-
-
 SequenceTemplate::PostProcessor::PostProcessor(GL::PostProcessor::Template *ppt):
        postprocessor_template(ppt)
 { }
index 52c42bb1b18046490ba981cc205da22aac3559ee..972a6b0b18939e6deda71e243d3dd89a31594eb9 100644 (file)
@@ -87,14 +87,12 @@ public:
                };
 
                std::string tag;
-               const Lighting *lighting;
+               const Lighting *lighting = 0;
                DepthTest depth_test;
                StencilTest stencil_test;
                Blend blend;
                std::string slot_name;
-               Renderable *default_renderable;
-
-               ~Step();
+               Renderable *default_renderable = 0;
        };
 
        struct PostProcessor
@@ -119,19 +117,18 @@ private:
 
        typedef TypeRegistry<PostProcLoader::AddPostProc, PostProcLoader &> PostProcessorRegistry;
 
-       bool hdr;
-       bool alpha;
-       unsigned required_multisample;
-       unsigned max_multisample;
+       bool hdr = false;
+       bool alpha = false;
+       unsigned required_multisample = 0;
+       unsigned max_multisample = 0;
        std::vector<Step> steps;
        std::vector<PostProcessor> postprocessors;
-       bool clear_enabled;
+       bool clear_enabled = false;
        std::vector<Color> clear_colors;
-       float clear_depth;
-       int clear_stencil;
+       float clear_depth = 1.0f;
+       int clear_stencil = 0;
 
 public:
-       SequenceTemplate();
        ~SequenceTemplate();
 
        bool get_hdr() const { return hdr; }
index 49a20b5cede9fb872506f6b166c6ff84ed541d1f..09d9ed602ebdd0ce569527bb194dc129f29ac4ec 100644 (file)
@@ -40,7 +40,7 @@ protected:
 public:
        VertexBuilder() { normal(0, 0, 1); }
 
-       virtual ~VertexBuilder() { }
+       virtual ~VertexBuilder() = default;
 
        void set_matrix(const Matrix &m)
        { mtx = m; }
index ac9e22b7d2a5ebadc7606d7dc9e065862921c18e..2e8f6b42217592f4873f81963ae4daac3dd06049 100644 (file)
@@ -7,12 +7,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Version::Version()
-{
-       major = 0;
-       minor = 0;
-}
-
 Version::Version(unsigned short a, unsigned short i)
 {
        major = a;
index 0dd0172c503637a388932468a4439d1d12ebd959..ef04bd1182c4214eff56f6baed75c22a47ace1bc 100644 (file)
@@ -14,10 +14,10 @@ enum GraphicsApi
 
 struct Version
 {
-       unsigned short major;
-       unsigned short minor;
+       unsigned short major = 0;
+       unsigned short minor = 0;
 
-       Version();
+       Version() = default;
        Version(unsigned short, unsigned short);
        Version(const std::string &);
 
index 85d3e57d5d6bd773c77202089d9a6128532b9a4a..99ffcd075c933a4441a8535dfed14b735a09acb4 100644 (file)
@@ -7,31 +7,17 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Blend::Blend():
-       enabled(false),
-       equation(ADD),
-       src_factor(ONE),
-       dst_factor(ZERO),
-       constant(0.0f, 0.0f, 0.0f, 0.0f),
-       write_mask(WRITE_ALL)
-{ }
-
 Blend::Blend(BlendFactor sf, BlendFactor df):
        enabled(true),
-       equation(ADD),
        src_factor(sf),
-       dst_factor(df),
-       constant(0.0f, 0.0f, 0.0f, 0.0f),
-       write_mask(WRITE_ALL)
+       dst_factor(df)
 { }
 
 Blend::Blend(BlendEquation e, BlendFactor sf, BlendFactor df):
        enabled(true),
        equation(e),
        src_factor(sf),
-       dst_factor(df),
-       constant(0.0f, 0.0f, 0.0f, 0.0f),
-       write_mask(WRITE_ALL)
+       dst_factor(df)
 { }
 
 
index e04aef49c2474cc7be4c49382044518331a6c9a2..1d39b08fd30b586ba8889b402310ffbb13aae9c5 100644 (file)
@@ -61,14 +61,14 @@ struct Blend
                void factors(BlendFactor, BlendFactor);
        };
 
-       bool enabled;
-       BlendEquation equation;
-       BlendFactor src_factor;
-       BlendFactor dst_factor;
-       Color constant;
-       ColorWriteMask write_mask;
-
-       Blend();
+       bool enabled = false;
+       BlendEquation equation = ADD;
+       BlendFactor src_factor = ONE;
+       BlendFactor dst_factor = ZERO;
+       Color constant = { 0.0f, 0.0f, 0.0f, 0.0f };
+       ColorWriteMask write_mask = WRITE_ALL;
+
+       Blend() = default;
        Blend(BlendFactor, BlendFactor);
        Blend(BlendEquation, BlendFactor, BlendFactor);
 };
index 811b3e41d7cbfb9ed16e613b29a7c28674d07659..523b737d32bf696ff3628e48ddd4b6b64e55f428 100644 (file)
@@ -8,10 +8,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Buffer::Buffer():
-       size(0)
-{ }
-
 void Buffer::storage(unsigned sz)
 {
        if(size>0)
index 9737a2ea9323ddd0af5c44b3d51d595eff6fc6d1..7682347ff1cf1962b411b36f146ca146c71d3b31 100644 (file)
@@ -27,11 +27,9 @@ class Buffer: public BufferBackend
        friend BufferBackend;
 
 private:
-       unsigned size;
+       unsigned size = 0;
 
 public:
-       Buffer();
-
        /** Defines the storage size of the buffer.  Must be called before data can
        be uploaded.  Storage cannot be changed once set. */
        void storage(unsigned);
index abbde26381019db839d0064bfdee1de83f889fbc..8f967df7a89967cf0d83ece6778d6a6ed3640539 100644 (file)
@@ -7,15 +7,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Bufferable::Bufferable():
-       buffer(0),
-       offset(0),
-       next_in_buffer(0),
-       prev_in_buffer(0),
-       location_dirty(false),
-       dirty(false)
-{ }
-
 Bufferable::~Bufferable()
 {
        unlink_from_buffer();
index 47e2770c58675fd128d16afa6b50446e7f53a62f..c7e26aefc0b8526b1a1ee330b3f38b15875fdb44 100644 (file)
@@ -29,15 +29,15 @@ public:
        };
 
 private:
-       Buffer *buffer;
-       unsigned offset;
-       Bufferable *next_in_buffer;
-       Bufferable *prev_in_buffer;
-       mutable bool location_dirty;
+       Buffer *buffer = 0;
+       unsigned offset = 0;
+       Bufferable *next_in_buffer = 0;
+       Bufferable *prev_in_buffer = 0;
+       mutable bool location_dirty = false;
 protected:
-       mutable bool dirty;
+       mutable bool dirty = false;
 
-       Bufferable();
+       Bufferable() = default;
 public:
        virtual ~Bufferable();
 
index fe784d256dbe5dfdf3c754fc3add92c458f96fd1..256f2beaaccafdf0ab83d4e72bee95cb330608c1 100644 (file)
@@ -5,19 +5,12 @@
 namespace Msp {
 namespace GL {
 
-ClipPlane::ClipPlane():
-       eq(0, 0, 0, 1),
-       generation(0)
-{ }
-
 ClipPlane::ClipPlane(const Vector4 &e):
-       eq(e),
-       generation(0)
+       eq(e)
 { }
 
 ClipPlane::ClipPlane(const Vector3 &p, const Vector3 &d):
-       eq(compose(d, -dot(p, d))),
-       generation(0)
+       eq(compose(d, -dot(p, d)))
 { }
 
 void ClipPlane::set_equation(const Vector4 &e)
index 2cf9b18bcde6b14d8975fa252222fe91ca4b8c39..a2b5625521f1f48463e22c9f06d7f5f5572782f5 100644 (file)
@@ -11,11 +11,11 @@ class ProgramData;
 class ClipPlane
 {
 private:
-       Vector4 eq;
-       unsigned generation;
+       Vector4 eq = { 0.0f, 0.0f, 0.0f, 1.0f };
+       unsigned generation = 0;
 
 public:
-       ClipPlane();
+       ClipPlane() = default;
        ClipPlane(const Vector4 &);
        ClipPlane(const Vector3 &, const Vector3 &);
 
index e57689bffe559d8f411670f910cceaa2ed94ead0..e376e3308bfed081d9e192dfecc100d7047874bb 100644 (file)
@@ -14,11 +14,14 @@ inline float to_linear(float c)
 
 struct Color
 {
-       float r, g, b, a;
-
-       Color(): r(1), g(1), b(1), a(1) { }
-       Color(float v): r(v), g(v), b(v), a(1) { }
-       Color(float r_, float g_, float b_): r(r_), g(g_), b(b_), a(1) { }
+       float r = 1.0f;
+       float g = 1.0f;
+       float b = 1.0f;
+       float a = 1.0f;
+
+       Color() = default;
+       Color(float v): r(v), g(v), b(v) { }
+       Color(float r_, float g_, float b_): r(r_), g(g_), b(b_) { }
        Color(float r_, float g_, float b_, float a_): r(r_), g(g_), b(b_), a(a_) { }
        Color operator*(float f) const { return Color(r*f, g*f, b*f, a); }
        Color operator+(const Color &c) const { return Color(r+c.r, g+c.g, b+c.b, 1-(1-a)*(1-c.a)); }
index 5ae4f7281356c31b1c489d5e83a29c2d0bbb3e70..dcd760233978e0257d391d590c02e639b41b4d33 100644 (file)
@@ -5,12 +5,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-DepthTest::DepthTest():
-       enabled(false),
-       compare(LESS),
-       write(true)
-{ }
-
 DepthTest::DepthTest(Predicate c, bool w):
        enabled(true),
        compare(c),
index d79f06e8d292f4bc39660dd03016dd9d9d0d6694..e6f1349a7816ff20594cfb22a4c1017a93d1f193 100644 (file)
@@ -22,11 +22,11 @@ struct DepthTest
                void compare(Predicate);
        };
 
-       bool enabled;
-       Predicate compare;
-       bool write;
+       bool enabled = false;
+       Predicate compare = LESS;
+       bool write = true;
 
-       DepthTest();
+       DepthTest() = default;
        DepthTest(Predicate, bool = true);
 };
 
index 613277233a84d78258fe40c2c585cbca24cf41bb..cc8dec4f5358346fbf53f33c002a745420fb098b 100644 (file)
@@ -208,12 +208,6 @@ Framebuffer &Framebuffer::system()
 }
 
 
-Framebuffer::Attachment::Attachment():
-       tex(0),
-       level(0),
-       layer(0)
-{ }
-
 void Framebuffer::Attachment::set(Texture &t, unsigned l, int z)
 {
        tex = &t;
index 0b9af1efd167e47addd3572eff9db4e80b87d3e1..e370b7c7f38976c2211c496c4c6c5e640f835e07 100644 (file)
@@ -41,11 +41,10 @@ class Framebuffer: public FramebufferBackend
 private:
        struct Attachment
        {
-               Texture *tex;
-               unsigned level;
-               int layer;
+               Texture *tex = 0;
+               unsigned level = 0;
+               int layer = 0;
 
-               Attachment();
                void set(Texture &, unsigned, int);
                void clear();
        };
index 36b45f6108d4e82f7ce2946d31b19d0c47932c5f..7fe179331abad0f9e1d70859e0da500ae142378b 100644 (file)
@@ -8,11 +8,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-FrameFormat::FrameFormat():
-       count(0),
-       samples(1)
-{ }
-
 FrameFormat::FrameFormat(FrameAttachment fa):
        count(1),
        samples(1)
index 90132092444488415a447b2840d03ad48c5fb58a..df4363758644160c98b8d9d7e2dbc4c42f641338 100644 (file)
@@ -36,12 +36,12 @@ class FrameFormat
 private:
        enum { MAX_ATTACHMENTS = 7 };
 
-       std::uint8_t count;
-       std::uint8_t samples;
+       std::uint8_t count = 0;
+       std::uint8_t samples = 0;
        FrameAttachment attachments[MAX_ATTACHMENTS];
 
 public:
-       FrameFormat();
+       FrameFormat() = default;
        FrameFormat(FrameAttachment);
 
        FrameFormat operator,(FrameAttachment) const;
index 1e811b5b2b135725db55ebb54f7bd2e9909afb5b..4679e3a3f43271fe91d9119e615ac30136d3b9a2 100644 (file)
@@ -9,14 +9,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Mesh::Mesh():
-       vbuf(0),
-       ibuf(0),
-       dirty(0),
-       disallow_rendering(false),
-       face_winding(NON_MANIFOLD)
-{ }
-
 Mesh::Mesh(const VertexFormat &f):
        Mesh()
 {
index 89f51fdd9e3493aa97bddd3e40409bffeb34f991..2d56193d14a104ccc3d08bb87fd0a11f5f8bbe11 100644 (file)
@@ -66,16 +66,16 @@ private:
 
        VertexArray vertices;
        std::vector<Batch> batches;
-       Buffer *vbuf;
-       Buffer *ibuf;
+       Buffer *vbuf = 0;
+       Buffer *ibuf = 0;
        VertexSetup vtx_setup;
-       mutable unsigned short dirty;
-       bool disallow_rendering;
-       FaceWinding face_winding;
+       mutable unsigned short dirty = 0;
+       bool disallow_rendering = false;
+       FaceWinding face_winding = NON_MANIFOLD;
        std::string debug_name;
 
 public:
-       Mesh();
+       Mesh() = default;
        Mesh(const VertexFormat &);
        ~Mesh();
 
index ed5f02823f0bf34671a7ee4a31e7dad4035f0dc9..eaed8a45c7b7ed04003e996d28bcd7c85b99e68c 100644 (file)
@@ -245,30 +245,6 @@ void SpirVModule::reflect()
 }
 
 
-SpirVModule::EntryPoint::EntryPoint():
-       stage(VERTEX)
-{ }
-
-
-SpirVModule::StructMember::StructMember():
-       type(VOID),
-       struct_type(0),
-       offset(0),
-       array_size(0),
-       array_size_spec(0),
-       array_stride(0),
-       matrix_stride(0)
-{ }
-
-
-SpirVModule::Variable::Variable():
-       type(VOID),
-       struct_type(0),
-       location(-1),
-       descriptor_set(-1),
-       binding(-1)
-{ }
-
 bool SpirVModule::Variable::operator==(const Variable &other) const
 {
        if(storage!=UNIFORM_CONSTANT && storage!=UNIFORM)
@@ -281,16 +257,6 @@ bool SpirVModule::Variable::operator==(const Variable &other) const
 }
 
 
-SpirVModule::TypeInfo::TypeInfo():
-       type(VOID),
-       struct_type(0),
-       array_size_spec(0),
-       array_size(0),
-       array_stride(0),
-       storage(static_cast<StorageClass>(-1))
-{ }
-
-
 uint32_t SpirVModule::Reflection::get_opcode(uint32_t op)
 {
        return op&0xFFFF;
index 34553b44c0e239bfeccac39b873a61b4ea26333d..7713d3ce0a77a79af54b61298868a31b24c77d1a 100644 (file)
@@ -31,9 +31,9 @@ public:
        };
 
 protected:
-       Module() { }
+       Module() = default;
 public:
-       virtual ~Module() { }
+       virtual ~Module() = default;
 
        virtual Format get_format() const = 0;
 
@@ -86,46 +86,40 @@ public:
        struct EntryPoint
        {
                std::string name;
-               Stage stage;
+               Stage stage = VERTEX;
                std::vector<const Variable *> globals;
-
-               EntryPoint();
        };
 
        struct StructMember
        {
                std::string name;
-               DataType type;
-               const Structure *struct_type;
-               unsigned offset;
-               unsigned array_size;
-               const Constant *array_size_spec;
-               unsigned array_stride;
-               unsigned matrix_stride;
-
-               StructMember();
+               DataType type = VOID;
+               const Structure *struct_type = 0;
+               unsigned offset = 0;
+               unsigned array_size = 0;
+               const Constant *array_size_spec = 0;
+               unsigned array_stride = 0;
+               unsigned matrix_stride = 0;
        };
 
        struct Structure
        {
                std::string name;
                std::vector<StructMember> members;
-               unsigned size;
+               unsigned size = 0;
        };
 
        struct Variable
        {
                std::string name;
-               StorageClass storage;
-               DataType type;
-               const Structure *struct_type;
-               const Constant *array_size_spec;
-               unsigned array_size;
-               int location;
-               int descriptor_set;
-               int binding;
-
-               Variable();
+               StorageClass storage = static_cast<StorageClass>(-1);
+               DataType type = VOID;
+               const Structure *struct_type = 0;
+               const Constant *array_size_spec = 0;
+               unsigned array_size = 0;
+               int location = -1;
+               int descriptor_set = -1;
+               int binding = -1;
 
                bool operator==(const Variable &) const;
        };
@@ -133,11 +127,11 @@ public:
        struct Constant
        {
                std::string name;
-               int constant_id;
-               DataType type;
+               int constant_id = -1;
+               DataType type = VOID;
                union
                {
-                       int i_value;
+                       int i_value = 0;
                        float f_value;
                };
        };
@@ -145,14 +139,12 @@ public:
 private:
        struct TypeInfo
        {
-               DataType type;
-               const Structure *struct_type;
-               const Constant *array_size_spec;
-               unsigned array_size;
-               unsigned array_stride;
-               StorageClass storage;
-
-               TypeInfo();
+               DataType type = VOID;
+               const Structure *struct_type = 0;
+               const Constant *array_size_spec = 0;
+               unsigned array_size = 0;
+               unsigned array_stride = 0;
+               StorageClass storage = static_cast<StorageClass>(-1);
        };
 
        struct Reflection
@@ -198,7 +190,7 @@ private:
        std::vector<Constant> spec_constants;
 
 public:
-       SpirVModule() { }
+       SpirVModule() = default;
        SpirVModule(const SpirVModule &);
        SpirVModule &operator=(const SpirVModule &);
 private:
index 15de0b4dce3e91f39bc1aea641a0a6d32da7979a..23a2ed6a96b9b61dfcabe7e044324da797773572 100644 (file)
@@ -7,21 +7,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-PipelineState::PipelineState():
-       framebuffer(0),
-       viewport(0),
-       scissor(0),
-       shprog(0),
-       vertex_setup(0),
-       front_face(COUNTERCLOCKWISE),
-       face_cull(NO_CULL),
-       enabled_clip_planes(0),
-       depth_test(0),
-       stencil_test(0),
-       blend(0),
-       changes(0)
-{ }
-
 template<typename T>
 void PipelineState::set(T &target, T value, unsigned flag)
 {
index 42543e4dc2596f5de2e2c0a7c71e85f9b64fa4c8..0d0520a0262565a1c56a9b78ab9bece536677e95 100644 (file)
@@ -60,25 +60,21 @@ private:
                SCISSOR = 2048
        };
 
-       const Framebuffer *framebuffer;
-       const Rect *viewport;
-       const Rect *scissor;
-       const Program *shprog;
-       const VertexSetup *vertex_setup;
-       FaceWinding front_face;
-       CullMode face_cull;
-       unsigned enabled_clip_planes;
+       const Framebuffer *framebuffer = 0;
+       const Rect *viewport = 0;
+       const Rect *scissor = 0;
+       const Program *shprog = 0;
+       const VertexSetup *vertex_setup = 0;
+       FaceWinding front_face = COUNTERCLOCKWISE;
+       CullMode face_cull = NO_CULL;
+       unsigned enabled_clip_planes = 0;
        std::vector<BoundTexture> textures;
        std::vector<BoundUniformBlock> uniform_blocks;
-       const DepthTest *depth_test;
-       const StencilTest *stencil_test;
-       const Blend *blend;
-       mutable unsigned changes;
+       const DepthTest *depth_test = 0;
+       const StencilTest *stencil_test = 0;
+       const Blend *blend = 0;
+       mutable unsigned changes = 0;
 
-public:
-       PipelineState();
-
-private:
        template<typename T>
        void set(T &, T, unsigned);
 public:
index f41a7d6ddf99d56218d8b53b6578853c2dca8e71..fd1c1ae09d10e12943ca13140339b96d59cd5ecf 100644 (file)
@@ -52,7 +52,7 @@ private:
 
 public:
        /// Constructs an empty Program with no shader stages attached.
-       Program() { }
+       Program() = default;
 
        /// Constructs a Program from a Module, with specialization constants.
        Program(const Module &, const std::map<std::string, int> & = std::map<std::string, int>());
index 333dbc25f7aa0466bd706acc13f279cb15b9c89e..4f6bd6bd43e266486d30844716475f9555119cef 100644 (file)
@@ -6,12 +6,12 @@ namespace GL {
 
 struct Rect
 {
-       int left;
-       int bottom;
-       unsigned width;
-       unsigned height;
+       int left = 0;
+       int bottom = 0;
+       unsigned width = 0;
+       unsigned height = 0;
 
-       Rect(): left(0), bottom(0), width(0), height(0) { }
+       Rect() = default;
        Rect(int l, int b, unsigned w, unsigned h): left(l), bottom(b), width(w), height(h) { }
 };
 
index 7a141db261f0b032aa3a9800a61079fa5a9162c2..db6798730cd4c9c9097e86735beeabed8e8114c3 100644 (file)
@@ -17,23 +17,6 @@ void ReflectData::update_layout_hash()
 }
 
 
-ReflectData::UniformInfo::UniformInfo():
-       block(0),
-       location(-1),
-       array_size(0),
-       array_stride(0),
-       matrix_stride(0),
-       type(VOID),
-       binding(-1)
-{ }
-
-
-ReflectData::UniformBlockInfo::UniformBlockInfo():
-       data_size(0),
-       bind_point(-1),
-       layout_hash(0)
-{ }
-
 void ReflectData::UniformBlockInfo::sort_uniforms()
 {
        sort(uniforms, [](const UniformInfo *u1, const UniformInfo *u2){ return u1->location<u2->location; });
@@ -47,12 +30,5 @@ void ReflectData::UniformBlockInfo::update_layout_hash()
        layout_hash = hash32(layout_descriptor);
 }
 
-
-ReflectData::AttributeInfo::AttributeInfo():
-       location(-1),
-       array_size(0),
-       type(VOID)
-{ }
-
 } // namespace GL
 } // namespace Msp
index 90b7ce0d4a41582a8f7e89809e4375c7ca4f7b24..fff190a52dcbde157e98f042e7ead8534d42713b 100644 (file)
@@ -20,31 +20,27 @@ struct ReflectData
        struct UniformInfo
        {
                std::string name;
-               const UniformBlockInfo *block;
+               const UniformBlockInfo *block = 0;
                union
                {
-                       int location;
+                       int location = -1;
                        unsigned offset;
                };
-               unsigned array_size;
-               unsigned array_stride;
-               unsigned matrix_stride;
-               DataType type;
+               unsigned array_size = 0;
+               unsigned array_stride = 0;
+               unsigned matrix_stride = 0;
+               DataType type = VOID;
                Tag tag;
-               int binding;
-
-               UniformInfo();
+               int binding = -1;
        };
 
        struct UniformBlockInfo
        {
                std::string name;
-               unsigned data_size;
-               int bind_point;
+               unsigned data_size = 0;
+               int bind_point = -1;
                std::vector<const UniformInfo *> uniforms;
-               LayoutHash layout_hash;
-
-               UniformBlockInfo();
+               LayoutHash layout_hash = 0;
 
                void sort_uniforms();
                void update_layout_hash();
@@ -53,11 +49,9 @@ struct ReflectData
        struct AttributeInfo
        {
                std::string name;
-               unsigned location;
-               unsigned array_size;
-               DataType type;
-
-               AttributeInfo();
+               unsigned location = -1;
+               unsigned array_size = 0;
+               DataType type = VOID;
        };
 
        std::vector<UniformBlockInfo> uniform_blocks;
index 6f4770acb4e40a73ea6270bfeabcbeeec273fcc8..6658ef9ac75d05a8b1016a84afb6847404b196d7 100644 (file)
@@ -7,19 +7,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Sampler::Sampler():
-       min_filter(NEAREST_MIPMAP_LINEAR),
-       mag_filter(LINEAR),
-       max_anisotropy(1.0f),
-       wrap_s(REPEAT),
-       wrap_t(REPEAT),
-       wrap_r(REPEAT),
-       border_color(Color(0.0f, 0.0f, 0.0f, 0.0f)),
-       compare(false),
-       cmp_func(LEQUAL),
-       dirty_params(0)
-{ }
-
 void Sampler::update() const
 {
        SamplerBackend::update(dirty_params);
index bd8db31fdc8f9601f5ac2ac55e9762cead38fef4..c79068775b144499943196b316dc0f8f0406f75b 100644 (file)
@@ -98,21 +98,17 @@ private:
                COMPARE = 128
        };
 
-       TextureFilter min_filter;
-       TextureFilter mag_filter;
-       float max_anisotropy;
-       TextureWrap wrap_s;
-       TextureWrap wrap_t;
-       TextureWrap wrap_r;
-       Color border_color;
-       bool compare;
-       Predicate cmp_func;
-       mutable int dirty_params;
+       TextureFilter min_filter = NEAREST_MIPMAP_LINEAR;
+       TextureFilter mag_filter = LINEAR;
+       float max_anisotropy = 1.0f;
+       TextureWrap wrap_s = REPEAT;
+       TextureWrap wrap_t = REPEAT;
+       TextureWrap wrap_r = REPEAT;
+       Color border_color = { 0.0f, 0.0f, 0.0f, 0.0f };
+       bool compare = false;
+       Predicate cmp_func = LEQUAL;
+       mutable int dirty_params = 0;
 
-public:
-       Sampler();
-
-private:
        void update() const;
 
 public:
index 2e8bbb4db865d5052885facfd96d25341ba1f906..2a1f0a846b7eb67cf75ea3a966a09345c2af453b 100644 (file)
@@ -8,16 +8,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-StencilTest::StencilTest():
-       enabled(false),
-       compare(ALWAYS),
-       stencil_fail_op(KEEP),
-       depth_fail_op(KEEP),
-       depth_pass_op(KEEP),
-       reference(0)
-{ }
-
-
 StencilTest::Loader::Loader(StencilTest &st):
        ObjectLoader<StencilTest>(st)
 {
index 652f8d4093b9ac3bdb82135d2a6fe834c36880ae..47e7a62787ff5bc0603b89732dfccbe71991def2 100644 (file)
@@ -37,14 +37,12 @@ struct StencilTest
                void actions(StencilOp, StencilOp, StencilOp);
        };
 
-       bool enabled;
-       Predicate compare;
-       StencilOp stencil_fail_op;
-       StencilOp depth_fail_op;
-       StencilOp depth_pass_op;
-       unsigned reference;
-
-       StencilTest();
+       bool enabled = false;
+       Predicate compare = ALWAYS;
+       StencilOp stencil_fail_op = KEEP;
+       StencilOp depth_fail_op = KEEP;
+       StencilOp depth_pass_op = KEEP;
+       unsigned reference = 0;
 };
 
 void operator>>(const LexicalConverter &, StencilOp &);
index dbc0b3ef47819470b17440642650dc9e6ee76ce4..edc33c631ba0c5df750809302b6a170a82545acb 100644 (file)
@@ -13,9 +13,9 @@ string is guaranteed to have an id of 0.
 */
 struct Tag
 {
-       unsigned id;
+       unsigned id = 0;
 
-       Tag(): id(0) { }
+       Tag() = default;
        Tag(const char *);
        Tag(const std::string &s);
 
index 1733a2d8e252b7c8bc4b330120a9500b3eb00ee5..1015a0af9c4aae7c2906c8363eca1100e1d267cb 100644 (file)
@@ -6,10 +6,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Texture1D::Texture1D():
-       width(0)
-{ }
-
 void Texture1D::storage(PixelFormat fmt, unsigned wd, unsigned lv)
 {
        if(width>0)
index 1871a17caaa4d282ae1fee19fb656c3686808029..04284697732784fc9ce9b84c1279d7bd40180665 100644 (file)
@@ -26,12 +26,10 @@ public:
        };
 
 private:
-       unsigned width;
-       unsigned levels;
+       unsigned width = 0;
+       unsigned levels = 0;
 
 public:
-       Texture1D();
-
        void storage(PixelFormat, unsigned, unsigned = 0);
 
        void image(unsigned, const void *);
index 01612d7325a8bf21c875e6e5a7de4f3de461657d..3c3579c1d131137f89ab49b57dd565f15a3ed544 100644 (file)
@@ -6,11 +6,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Texture2D::Texture2D():
-       width(0),
-       height(0)
-{ }
-
 Texture2D::~Texture2D()
 {
        set_manager(0);
index 4f0bde26960c0db5f4dee5c9a0edd381f86e285e..209cede5843535a40b888c872f6be88909fd8436 100644 (file)
@@ -32,12 +32,11 @@ public:
        };
 
 private:
-       unsigned width;
-       unsigned height;
-       unsigned levels;
+       unsigned width = 0;
+       unsigned height = 0;
+       unsigned levels = 0;
 
 public:
-       Texture2D();
        virtual ~Texture2D();
 
        /** Defines storage structure for the texture.  If lv is zero, the number
index 5ea37e90e3d82e81f2674f94691f2051c25f1a69..1c0106d7dda094396e52104d5d0989bf9a14ed8b 100644 (file)
@@ -7,11 +7,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Texture2DMultisample::Texture2DMultisample():
-       width(0),
-       height(0)
-{ }
-
 void Texture2DMultisample::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned sm)
 {
        if(width>0)
index 9710ad7847b131baefc4889c396d54163e53b20f..8c3275c0b3758fcbad92dd2a8c34ec557684c0a4 100644 (file)
@@ -11,13 +11,11 @@ class Texture2DMultisample: public Texture2DMultisampleBackend
        friend Texture2DMultisampleBackend;
 
 private:
-       unsigned width;
-       unsigned height;
-       unsigned samples;
+       unsigned width = 0;
+       unsigned height = 0;
+       unsigned samples = 0;
 
 public:
-       Texture2DMultisample();
-
        void storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned sm);
 
        virtual void image(const Graphics::Image &, unsigned = 0);
index 0fb26ccd6e2606eea34f24cc30fc5e9209ae08c8..e48b7662011deb9b1c81ce5c73014c939ace2c52 100644 (file)
@@ -8,16 +8,7 @@ namespace Msp {
 namespace GL {
 
 Texture3D::Texture3D(unsigned t):
-       Texture3DBackend(t),
-       width(0),
-       height(0),
-       depth(0)
-{ }
-
-Texture3D::Texture3D():
-       width(0),
-       height(0),
-       depth(0)
+       Texture3DBackend(t)
 { }
 
 void Texture3D::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned dp, unsigned lv)
index 21893abc07e5fc19c4915cb34c4882086d5bdf36..4a166174fbf75fb30bb8800ca3a3017c1ef5b43f 100644 (file)
@@ -31,14 +31,14 @@ public:
        };
 
 protected:
-       unsigned width;
-       unsigned height;
-       unsigned depth;
-       unsigned levels;
+       unsigned width = 0;
+       unsigned height = 0;
+       unsigned depth = 0;
+       unsigned levels = 0;
 
        Texture3D(unsigned);
 public:
-       Texture3D();
+       Texture3D() = default;
 
        /** Defines storage structure for the texture.  If lv is zero, the number
        of mipmap levels is automatically determined from storage dimensions.
index ea29499732646897dd9e81c7080c8cc3bc9ff013..9aec4b1d19640f699adbf8c2596a7e14555b6200 100644 (file)
@@ -29,10 +29,6 @@ const unsigned TextureCube::orientations[12] =
        1, 3
 };
 
-TextureCube::TextureCube():
-       size(0)
-{ }
-
 void TextureCube::storage(PixelFormat fmt, unsigned sz, unsigned lv)
 {
        if(size>0)
index 363ceea331e2f453490813741e6631c255701874..2f445919ba718ad97d3cda995fc4cc2aba25ce7a 100644 (file)
@@ -51,15 +51,13 @@ public:
        };
 
 private:
-       unsigned size;
-       unsigned levels;
+       unsigned size = 0;
+       unsigned levels = 0;
 
        static const Vector3 directions[6];
        static const unsigned orientations[12];
 
 public:
-       TextureCube();
-
        /** Defines storage structure for the texture.  If lv is zero, the number
        of mipmap levels is automatically determined from storage dimensions.
 
index 30bc9bcc6588ae9233fe7491cc30f49dcf403124..796bef8053c15a346273bd03beaa8c80abe73d74 100644 (file)
@@ -6,10 +6,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-VertexArray::VertexArray():
-       stride(0)
-{ }
-
 VertexArray::VertexArray(const VertexFormat &f)
 {
        set_format(f);
index 290fa10c455f07b56f95c6ab0da3cfa9cc8f5fab..d80b2786db4d996f04b74d9514b3baaa1fecbf61 100644 (file)
@@ -32,12 +32,12 @@ public:
 private:
        VertexFormat format;
        std::vector<char> data;
-       unsigned stride;
+       unsigned stride = 0;
 
        VertexArray(const VertexArray &);
        VertexArray &operator=(const VertexArray &);
 public:
-       VertexArray();
+       VertexArray() = default;
 
        /// Construct a VertexArray and set its format.
        VertexArray(const VertexFormat &);
index b95da9d1af0a94ad94ae64a554a6e8f04c131879..ff043f7d0466bef73b08e216836617ef8fe9200f 100644 (file)
@@ -7,10 +7,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-VertexFormat::VertexFormat():
-       count(0)
-{ }
-
 VertexFormat::VertexFormat(VertexAttribute a):
        count(1)
 {
index f9f99398fc7fe66186a74ad7836e2567fc02cf0c..4ff3401778d15b5989130d4dcf6c2ce803eb4bee 100644 (file)
@@ -75,11 +75,11 @@ class VertexFormat
 private:
        enum { MAX_ATTRIBUTES = 15 };
 
-       std::uint8_t count;
+       std::uint8_t count = 0;
        VertexAttribute attributes[MAX_ATTRIBUTES];
 
 public:
-       VertexFormat();
+       VertexFormat() = default;
        VertexFormat(VertexAttribute);
 
        VertexFormat operator,(VertexAttribute) const;
index 4fd589a9698bfe8a1616a4d097902a984e4f9c49..7b346d8ecf5f497e53cb91d8cc65765e8fac5b01 100644 (file)
@@ -8,14 +8,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-VertexSetup::VertexSetup():
-       dirty(0),
-       vertex_array(0),
-       inst_array(0),
-       index_buffer(0),
-       index_type(UNSIGNED_SHORT)
-{ }
-
 void VertexSetup::set_format(const VertexFormat &vfmt)
 {
        if(!verify_format(vfmt))
index 7daef8845ac03688c570af5c40ff10f8a80324dc..208e55d3cd676729d4299024feaad06a273bf3d2 100644 (file)
@@ -27,17 +27,15 @@ private:
                INDEX_BUFFER = 4
        };
 
-       mutable unsigned dirty;
-       const VertexArray *vertex_array;
+       mutable unsigned dirty = 0;
+       const VertexArray *vertex_array = 0;
        VertexFormat vertex_format;
-       const VertexArray *inst_array;
+       const VertexArray *inst_array = 0;
        VertexFormat inst_format;
-       const Buffer *index_buffer;
-       DataType index_type;
+       const Buffer *index_buffer = 0;
+       DataType index_type = UNSIGNED_SHORT;
 
 public:
-       VertexSetup();
-
        void set_format(const VertexFormat &);
        void set_format_instanced(const VertexFormat &, const VertexFormat &);
 
index d431bcdd51ea68417a6b285b1b7ba8773542742b..8149e408ee0a1dcc323e441c61c91d4f58842349 100644 (file)
@@ -128,13 +128,6 @@ void AmbientOcclusion::set_debug_name(const string &name)
 }
 
 
-AmbientOcclusion::Template::Template():
-       n_samples(16),
-       occlusion_radius(0.5f),
-       darkness(1.0f),
-       edge_depth_threshold(0.1f)
-{ }
-
 AmbientOcclusion *AmbientOcclusion::Template::create(unsigned width, unsigned height) const
 {
        RefPtr<AmbientOcclusion> ao = new AmbientOcclusion(width/size_divisor, height/size_divisor);
index fd3b6574cbbdfec1b83b2244d1e5e744cf003532..efaa2f378b2be66282648d2855f602fcc1a59071 100644 (file)
@@ -26,12 +26,10 @@ public:
                        Loader(Template &);
                };
 
-               unsigned n_samples;
-               float occlusion_radius;
-               float darkness;
-               float edge_depth_threshold;
-
-               Template();
+               unsigned n_samples = 16;
+               float occlusion_radius = 0.5f;
+               float darkness = 1.0f;
+               float edge_depth_threshold = 0.1f;
 
                virtual AmbientOcclusion *create(unsigned, unsigned) const;
        };
index a6fefa6ecc014cb68ddcb41e443128f33295e430..8a8dea3ed687752ea408c4efdbb4b5ce0f06cc2a 100644 (file)
@@ -93,11 +93,6 @@ void Bloom::set_debug_name(const string &name)
 }
 
 
-Bloom::Template::Template():
-       radius(2.0f),
-       strength(0.2f)
-{ }
-
 Bloom *Bloom::Template::create(unsigned width, unsigned height) const
 {
        RefPtr<Bloom> bloom = new Bloom(width/size_divisor, height/size_divisor);
index d6c9307cf8d43148818669f3007dbca223c8ec5d..94057b2f7b21a0603db19432fcfe4602082a0a3b 100644 (file)
@@ -29,10 +29,8 @@ public:
                        Loader(Template &);
                };
 
-               float radius;
-               float strength;
-
-               Template();
+               float radius = 2.0f;
+               float strength = 0.2f;
 
                virtual Bloom *create(unsigned, unsigned) const;
        };
index f4a786a44925f22ca749230bb1049ca30f71fddf..c64f85317ed2822424db8fc95e5e1a6a1f813e2d 100644 (file)
@@ -86,13 +86,6 @@ void ColorCurve::set_debug_name(const string &name)
 }
 
 
-ColorCurve::Template::Template():
-       exposure_adjust(0.0f),
-       brightness_response(0.4f),
-       gamma(1.0f),
-       srgb(false)
-{ }
-
 ColorCurve *ColorCurve::Template::create(unsigned, unsigned) const
 {
        RefPtr<ColorCurve> colorcurve = new ColorCurve();
index 01a7d35dcb37eecfebc9fb1e3df8fc6c5b57b21f..5cebcb00835e818fe2b44a303928b2b502c149f4 100644 (file)
@@ -34,12 +34,10 @@ public:
                        void srgb();
                };
 
-               float exposure_adjust;
-               float brightness_response;
-               float gamma;
-               bool srgb;
-
-               Template();
+               float exposure_adjust = 0.0f;
+               float brightness_response = 0.4f;
+               float gamma = 1.0f;
+               bool srgb = false;
 
                virtual ColorCurve *create(unsigned, unsigned) const;
        };
index 47cea0904017c2daa7bbeff4328ec7d5d4128573..6fb0e5c3b314656dca8361dc9b54544969c98c68 100644 (file)
@@ -17,6 +17,7 @@ EnvironmentMap::EnvironmentMap(unsigned s, PixelFormat f, Renderable &r, Rendera
 
 EnvironmentMap::EnvironmentMap(unsigned s, PixelFormat f, unsigned l, Renderable &r, Renderable &e):
        Effect(r),
+       size(s),
        environment(e),
        irradiance_shprog(Resources::get_global().get<Program>("_envmap_irradiance.glsl.shader")),
        specular_shprog(Resources::get_global().get<Program>("_envmap_specular.glsl.shader")),
@@ -27,11 +28,6 @@ EnvironmentMap::EnvironmentMap(unsigned s, PixelFormat f, unsigned l, Renderable
        if(!l || (1U<<(l-1))>=s)
                throw invalid_argument("EnvironmentMap::EnvironmentMap");
 
-       size = s;
-       rendered = false;
-       update_interval = 1;
-       update_delay = 0;
-
        env_tex.storage(f, size, l);
        depth_buf.storage(DEPTH_COMPONENT32F, size, size, 1);
        for(unsigned i=0; i<6; ++i)
index 2d27ee7d86cfd53e82af53589ecfb8f420d01a59..f9f4cf5306e3af142be170b3714ad84c91800e8e 100644 (file)
@@ -52,9 +52,9 @@ private:
        const Sampler &sampler;
        const Sampler &mip_sampler;
        ProgramData shdata;
-       bool rendered;
-       unsigned update_interval;
-       unsigned update_delay;
+       bool rendered = false;
+       unsigned update_interval = 1;
+       unsigned update_delay = 0;
 
 public:
        EnvironmentMap(unsigned size, PixelFormat, Renderable &rend, Renderable &env);
index e6308634f741e471c5b2e3e095b7cbceca7d4486..246f6ef8d0c57c1bfab9296434c1747e8974460a 100644 (file)
@@ -6,11 +6,6 @@
 namespace Msp {
 namespace GL {
 
-PostProcessor::Template::Template():
-       size_divisor(1)
-{ }
-
-
 PostProcessor::Template::Loader::Loader(Template &t):
        DataFile::ObjectLoader<Template>(t)
 {
index ee169e79470eedded9a31436581437183e04fcd1..8b2884acf6a360953f2e0a63ddeec2d44a64e689 100644 (file)
@@ -27,10 +27,9 @@ public:
                        Loader(Template &);
                };
 
-               unsigned size_divisor;
+               unsigned size_divisor = 1;
 
-               Template();
-               virtual ~Template() { }
+               virtual ~Template() = default;
 
                virtual PostProcessor *create(unsigned, unsigned) const = 0;
        };
index a0627faabf14834fd959ad1abe043dbb79feef18..36011107e3d19de1f6aa07eb7235d0fdc9d869bc 100644 (file)
@@ -17,11 +17,7 @@ ShadowMap::ShadowMap(unsigned w, unsigned h, Renderable &r, const Lighting *l, R
        height(h),
        lighting(l),
        shadow_caster(c),
-       sampler(Resources::get_global().get<Sampler>("_linear_clamp_shadow.samp")),
-       radius(1),
-       depth_bias(4),
-       darkness(1.0f),
-       rendered(false)
+       sampler(Resources::get_global().get<Sampler>("_linear_clamp_shadow.samp"))
 {
        depth_buf.storage(DEPTH_COMPONENT32F, width, height, 1);
        fbo.set_format((DEPTH_ATTACHMENT,DEPTH_COMPONENT32F));
index cb6229935a81806dc3bad9af00b72bed47e739b7..611f56f51040a2204055e29f37d0e67a68d48b7c 100644 (file)
@@ -41,11 +41,11 @@ private:
        Texture2D depth_buf;
        const Sampler &sampler;
        Vector3 target;
-       float radius;
-       float depth_bias;
-       float darkness;
+       float radius = 1.0f;
+       float depth_bias = 4.0f;
+       float darkness = 1.0f;
        ProgramData shdata;
-       bool rendered;
+       bool rendered = false;
        std::string debug_name;
 
        ShadowMap(unsigned, unsigned, Renderable &, const Lighting *, Renderable &);
index 41734fe85fdb6d170765353653038a6df9183f43..506fba1c417c62657ee98292febc5102a5a752cd 100644 (file)
@@ -25,17 +25,11 @@ namespace GL {
 namespace SL {
 
 Compiler::Compiler():
-       features(DeviceInfo::get_global().glsl_features),
-       module(0),
-       compiled(false),
-       specialized(false)
+       features(DeviceInfo::get_global().glsl_features)
 { }
 
 Compiler::Compiler(const Features &f):
-       features(f),
-       module(0),
-       compiled(false),
-       specialized(false)
+       features(f)
 { }
 
 Compiler::~Compiler()
index f9e0e3fe2aa554f623b1d9c85f8f284e5808f58f..1c07f3250d9bc4d964168a7fd868a16346e5cd06 100644 (file)
@@ -40,10 +40,10 @@ private:
        };
 
        Features features;
-       Module *module;
+       Module *module = 0;
        std::vector<std::string> imported_names;
-       bool compiled;
-       bool specialized;
+       bool compiled = false;
+       bool specialized = false;
        std::map<std::string, int> spec_values;
 
 public:
index a66eefc5ad18bb6271a9086b245697bb8b6632d0..943f3b06fb8080b04defa5f807219b32ab404f4c 100644 (file)
@@ -4,21 +4,6 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
-Features::Features():
-       target_api(OPENGL),
-       arb_enhanced_layouts(false),
-       arb_explicit_attrib_location(false),
-       arb_explicit_uniform_location(false),
-       arb_gpu_shader5(false),
-       arb_separate_shader_objects(false),
-       arb_uniform_buffer_object(false),
-       ext_gpu_shader4(false),
-       ext_texture_array(false),
-       constant_id_range(0x80000000U),
-       uniform_binding_range(84),
-       texture_binding_range(96)
-{ }
-
 Features Features::from_version(const Version &ver)
 {
        Features features;
index ca74d38abd3d2a2927420589f21af83ac21ea5b6..14cc2b3743ed61cae347c62d90470f3fac9ad3c4 100644 (file)
@@ -9,21 +9,19 @@ namespace SL {
 
 struct Features
 {
-       GraphicsApi target_api;
+       GraphicsApi target_api = OPENGL;
        Version glsl_version;
-       bool arb_enhanced_layouts;
-       bool arb_explicit_attrib_location;
-       bool arb_explicit_uniform_location;
-       bool arb_gpu_shader5;
-       bool arb_separate_shader_objects;
-       bool arb_uniform_buffer_object;
-       bool ext_gpu_shader4;
-       bool ext_texture_array;
-       unsigned constant_id_range;
-       unsigned uniform_binding_range;
-       unsigned texture_binding_range;
-
-       Features();
+       bool arb_enhanced_layouts = false;
+       bool arb_explicit_attrib_location = false;
+       bool arb_explicit_uniform_location = false;
+       bool arb_gpu_shader5 = false;
+       bool arb_separate_shader_objects = false;
+       bool arb_uniform_buffer_object = false;
+       bool ext_gpu_shader4 = false;
+       bool ext_texture_array = false;
+       unsigned constant_id_range = 0x80000000U;
+       unsigned uniform_binding_range = 84;
+       unsigned texture_binding_range = 96;
 
        static Features from_version(const Version &);
        static Features latest();
index e444974ae9fbe26cc4e0168e063cd4b8177f8416..4068037e919e81b5cc514d12584bec7df8088360 100644 (file)
@@ -12,10 +12,6 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
-StructOrganizer::StructOrganizer():
-       offset(-1)
-{ }
-
 void StructOrganizer::visit(StructDeclaration &strct)
 {
        SetForScope<int> set_offset(offset, 0);
@@ -238,10 +234,6 @@ void LocationAllocator::visit(InterfaceBlock &iface)
 }
 
 
-PrecisionConverter::PrecisionConverter():
-       stage(0)
-{ }
-
 void PrecisionConverter::apply(Stage &s)
 {
        stage = &s;
@@ -308,10 +300,6 @@ void PrecisionConverter::visit(VariableDeclaration &var)
 }
 
 
-LegacyConverter::LegacyConverter():
-       frag_out(0)
-{ }
-
 void LegacyConverter::apply(Stage &s, const Features &feat)
 {
        stage = &s;
index fd29737a713b3ed331e9ba4b0bddb2e13b9f72a6..1fe5fa45a494b02988c90f37068ee4c34e760ca1 100644 (file)
@@ -12,11 +12,9 @@ namespace SL {
 class StructOrganizer: private TraversingVisitor
 {
 private:
-       int offset;
+       int offset = -1;
 
 public:
-       StructOrganizer();
-
        void apply(Stage &s) { s.content.visit(*this); }
 
 private:
@@ -64,14 +62,12 @@ according to the requirements of the target API. */
 class PrecisionConverter: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        std::set<std::string> have_default;
        NodeList<Statement>::iterator insert_point;
        std::set<Node *> nodes_to_remove;
 
 public:
-       PrecisionConverter();
-
        void apply(Stage &);
 
 private:
@@ -85,15 +81,13 @@ features. */
 class LegacyConverter: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        Features features;
-       VariableDeclaration *frag_out;
+       VariableDeclaration *frag_out = 0;
        NodeList<Statement>::iterator uniform_insert_point;
        std::set<Node *> nodes_to_remove;
 
 public:
-       LegacyConverter();
-
        virtual void apply(Stage &, const Features &);
 
 private:
index a17f7fb502a9e751eb17fe92f4b5d8c2ea383add..ec51c19cdd9cc90472a0b2471eff915823fae0d7 100644 (file)
@@ -44,13 +44,6 @@ void ConstantIdAssigner::visit(VariableDeclaration &var)
 }
 
 
-InterfaceGenerator::InterfaceGenerator():
-       stage(0),
-       function_scope(false),
-       copy_block(false),
-       iface_target_block(0)
-{ }
-
 string InterfaceGenerator::get_out_prefix(Stage::Type type)
 {
        if(type==Stage::VERTEX)
index eb7d488ae6071faa619f3e374c61084686e028b9..fc58b2db16134108cf4e7fa653d6c1a6258b9ce3 100644 (file)
@@ -36,20 +36,18 @@ Unresolved variables are looked up in the previous stage's out variables. */
 class InterfaceGenerator: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        std::string in_prefix;
        std::string out_prefix;
-       bool function_scope;
-       bool copy_block;
+       bool function_scope = false;
+       bool copy_block = false;
        std::vector<VariableDeclaration *> declared_inputs;
-       Block *iface_target_block;
+       Block *iface_target_block = 0;
        NodeList<Statement>::iterator iface_insert_point;
        NodeList<Statement>::iterator assignment_insert_point;
        std::set<Node *> nodes_to_remove;
 
 public:
-       InterfaceGenerator();
-
        void apply(Stage &);
 
 private:
index d7bf458ce7782f55ac6e59b830549a66fe27b94d..392682db7b5693c210a5ec9eb495c55cdc824f27 100644 (file)
@@ -20,14 +20,6 @@ parse_error::parse_error(const Location &loc, const string &token, const string
 { }
 
 
-Diagnostic::Diagnostic():
-       severity(INFO),
-       source(0),
-       line(0),
-       provoking_source(0),
-       provoking_line(0)
-{ }
-
 Diagnostic::Diagnostic(Severity v, int s, unsigned l, const string &m):
        severity(v),
        source(s),
index 0b4b4b02d2ddff4641f41b5c59ce2df6c1d110f7..0a271994299f22db6dacd16ea25f350db695cd49 100644 (file)
@@ -54,14 +54,14 @@ struct Diagnostic
                ERR
        };
 
-       Severity severity;
-       int source;
-       unsigned line;
-       int provoking_source;
-       unsigned provoking_line;
+       Severity severity = INFO;
+       int source = 0;
+       unsigned line = 0;
+       int provoking_source = 0;
+       unsigned provoking_line = 0;
        std::string message;
 
-       Diagnostic();
+       Diagnostic() = default;
        Diagnostic(Severity, int, unsigned, const std::string &);
 };
 
index a24d85dd5f0b7f025e01ab7b13dca85238b09535..8c586e7ad886cf433c4c5cadf6315783980804a6 100644 (file)
@@ -11,10 +11,6 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
-ConstantSpecializer::ConstantSpecializer():
-       values(0)
-{ }
-
 void ConstantSpecializer::apply(Stage &stage, const map<string, int> &v)
 {
        values = &v;
@@ -59,11 +55,6 @@ void ConstantSpecializer::visit(VariableDeclaration &var)
 }
 
 
-InlineableFunctionLocator::InlineableFunctionLocator():
-       current_function(0),
-       return_count(0)
-{ }
-
 void InlineableFunctionLocator::visit(FunctionCall &call)
 {
        FunctionDeclaration *def = call.declaration;
@@ -118,11 +109,6 @@ void InlineableFunctionLocator::visit(Return &ret)
 }
 
 
-InlineContentInjector::InlineContentInjector():
-       source_func(0),
-       pass(REFERENCED)
-{ }
-
 string InlineContentInjector::apply(Stage &stage, FunctionDeclaration &target_func, Block &tgt_blk, const NodeList<Statement>::iterator &ins_pt, FunctionCall &call)
 {
        source_func = call.declaration->definition;
@@ -257,12 +243,6 @@ void InlineContentInjector::visit(Return &ret)
 }
 
 
-FunctionInliner::FunctionInliner():
-       current_function(0),
-       r_any_inlined(false),
-       r_inlined_here(false)
-{ }
-
 bool FunctionInliner::apply(Stage &s)
 {
        stage = &s;
@@ -348,16 +328,6 @@ void FunctionInliner::visit(Iteration &iter)
 }
 
 
-ExpressionInliner::ExpressionInliner():
-       r_ref_info(0),
-       r_trivial(false),
-       access_read(true),
-       access_write(false),
-       iteration_init(false),
-       iteration_body(0),
-       r_oper(0)
-{ }
-
 bool ExpressionInliner::apply(Stage &s)
 {
        s.content.visit(*this);
@@ -983,10 +953,6 @@ void ConstantConditionEliminator::visit(Iteration &iter)
 }
 
 
-UnreachableCodeRemover::UnreachableCodeRemover():
-       reachable(true)
-{ }
-
 bool UnreachableCodeRemover::apply(Stage &stage)
 {
        stage.content.visit(*this);
@@ -1080,17 +1046,6 @@ void UnusedTypeRemover::visit(FunctionDeclaration &func)
 }
 
 
-UnusedVariableRemover::UnusedVariableRemover():
-       stage(0),
-       interface_block(0),
-       r_assignment(0),
-       assignment_target(false),
-       r_side_effects(false),
-       in_struct(false),
-       composite_reference(false),
-       in_loop(0)
-{ }
-
 bool UnusedVariableRemover::apply(Stage &s)
 {
        stage = &s;
index 92353a77ee1748c651d8d6f35ab266d6a429593c..ae55e5af10f5590f886906355342327a8ddb87be 100644 (file)
@@ -14,11 +14,9 @@ constants. */
 class ConstantSpecializer: private TraversingVisitor
 {
 private:
-       const std::map<std::string, int> *values;
+       const std::map<std::string, int> *values = 0;
 
 public:
-       ConstantSpecializer();
-
        void apply(Stage &, const std::map<std::string, int> &);
 
 private:
@@ -33,12 +31,10 @@ class InlineableFunctionLocator: private TraversingVisitor
 private:
        std::map<FunctionDeclaration *, unsigned> refcounts;
        std::set<FunctionDeclaration *> inlineable;
-       FunctionDeclaration *current_function;
-       unsigned return_count;
+       FunctionDeclaration *current_function = 0;
+       unsigned return_count = 0;
 
 public:
-       InlineableFunctionLocator();
-
        std::set<FunctionDeclaration *> apply(Stage &s) { s.content.visit(*this); return inlineable; }
 
 private:
@@ -62,17 +58,15 @@ private:
                RENAME
        };
 
-       FunctionDeclaration *source_func;
+       FunctionDeclaration *source_func = 0;
        Block staging_block;
-       Pass pass;
+       Pass pass = REFERENCED;
        RefPtr<Statement> r_inlined_statement;
        std::set<Node *> dependencies;
        std::set<std::string> referenced_names;
        std::string r_result_name;
 
 public:
-       InlineContentInjector();
-
        std::string apply(Stage &, FunctionDeclaration &, Block &, const NodeList<Statement>::iterator &, FunctionCall &);
 
 private:
@@ -89,17 +83,15 @@ are inlined. */
 class FunctionInliner: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        std::set<FunctionDeclaration *> inlineable;
-       FunctionDeclaration *current_function;
+       FunctionDeclaration *current_function = 0;
        NodeList<Statement>::iterator insert_point;
        RefPtr<Expression> r_inline_result;
-       bool r_any_inlined;
-       bool r_inlined_here;
+       bool r_any_inlined = false;
+       bool r_inlined_here = false;
 
 public:
-       FunctionInliner();
-
        bool apply(Stage &);
 
 private:
@@ -118,37 +110,31 @@ class ExpressionInliner: private TraversingVisitor
 private:
        struct ExpressionUse
        {
-               RefPtr<Expression> *reference;
-               Block *ref_scope;
-               bool blocked;
-
-               ExpressionUse(): reference(0), ref_scope(0), blocked(false) { }
+               RefPtr<Expression> *reference = 0;
+               Block *ref_scope = 0;
+               bool blocked = false;
        };
 
        struct ExpressionInfo
        {
                Assignment::Target target;
                RefPtr<Expression> expression;
-               Block *assign_scope;
+               Block *assign_scope = 0;
                std::vector<ExpressionUse> uses;
-               bool trivial;
-
-               ExpressionInfo(): expression(0), assign_scope(0), trivial(false) { }
+               bool trivial = false;
        };
 
        std::list<ExpressionInfo> expressions;
        std::map<Assignment::Target, ExpressionInfo *> assignments;
-       ExpressionInfo *r_ref_info;
-       bool r_trivial;
-       bool access_read;
-       bool access_write;
-       bool iteration_init;
-       Block *iteration_body;
-       const Operator *r_oper;
+       ExpressionInfo *r_ref_info = 0;
+       bool r_trivial = false;
+       bool access_read = true;
+       bool access_write = false;
+       bool iteration_init = false;
+       Block *iteration_body = 0;
+       const Operator *r_oper = 0;
 
 public:
-       ExpressionInliner();
-
        bool apply(Stage &);
 
 private:
@@ -170,14 +156,14 @@ evaluating the expression.*/
 class ConstantFolder: private TraversingVisitor
 {
 private:
-       VariableDeclaration *iteration_var;
+       VariableDeclaration *iteration_var = 0;
        Variant iter_init_value;
        Variant r_constant_value;
-       bool iteration_init;
-       bool r_constant;
-       bool r_literal;
-       bool r_uses_iter_var;
-       bool r_any_folded;
+       bool iteration_init = false;
+       bool r_constant = false;
+       bool r_literal = false;
+       bool r_uses_iter_var = false;
+       bool r_any_folded = false;
 
 public:
        bool apply(Stage &s) { s.content.visit(*this); return r_any_folded; }
@@ -225,7 +211,7 @@ private:
        NodeList<Statement>::iterator insert_point;
        std::set<Node *> nodes_to_remove;
        RefPtr<Expression> r_ternary_result;
-       bool r_external_side_effects;
+       bool r_external_side_effects = false;
 
 public:
        void apply(Stage &);
@@ -246,12 +232,10 @@ private:
 class UnreachableCodeRemover: private TraversingVisitor
 {
 private:
-       bool reachable;
+       bool reachable = true;
        std::set<Node *> unreachable_nodes;
 
 public:
-       UnreachableCodeRemover();
-
        virtual bool apply(Stage &);
 
 private:
@@ -289,44 +273,38 @@ class UnusedVariableRemover: private TraversingVisitor
 private:
        struct AssignmentInfo
        {
-               Node *node;
+               Node *node = 0;
                Assignment::Target target;
                std::vector<Node *> used_by;
-               unsigned in_loop;
-
-               AssignmentInfo(): node(0) { }
+               unsigned in_loop = 0;
        };
 
        struct VariableInfo
        {
-               InterfaceBlock *interface_block;
+               InterfaceBlock *interface_block = 0;
                std::vector<AssignmentInfo *> assignments;
-               bool initialized;
-               bool output;
-               bool referenced;
-
-               VariableInfo(): interface_block(0), initialized(false), output(false), referenced(false) { }
+               bool initialized = false;
+               bool output = false;
+               bool referenced = false;
        };
 
        typedef std::map<Statement *, VariableInfo> BlockVariableMap;
 
-       Stage *stage;
+       Stage *stage = 0;
        BlockVariableMap variables;
        std::list<AssignmentInfo> assignments;
-       InterfaceBlock *interface_block;
-       Assignment *r_assignment;
-       bool assignment_target;
-       bool r_side_effects;
-       bool in_struct;
-       bool composite_reference;
-       unsigned in_loop;
+       InterfaceBlock *interface_block = 0;
+       Assignment *r_assignment = 0;
+       bool assignment_target = false;
+       bool r_side_effects = false;
+       bool in_struct = false;
+       bool composite_reference = false;
+       unsigned in_loop = 0;
        std::vector<Node *> loop_ext_refs;
        Assignment::Target r_reference;
        std::set<Node *> unused_nodes;
 
 public:
-       UnusedVariableRemover();
-
        bool apply(Stage &);
 
 private:
index 0a4af2d42b0997f6d72f89542e1b6c038c3357d5..c2c54f9ff33834d11d681a0e80e976aa75747b39 100644 (file)
@@ -8,16 +8,6 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
-Formatter::Formatter():
-       stage(0),
-       source_index(0),
-       source_line(1),
-       indent(0),
-       parameter_list(false),
-       omit_builtin(false),
-       r_empty_name(false)
-{ }
-
 string Formatter::apply(Stage &s)
 {
        stage = &s;
index 09cdf0714fb735103ba1cbedac9e2e53239d97fe..dbdd888e5923aa69355c9fe75923bcadf7e12c61 100644 (file)
@@ -13,18 +13,16 @@ namespace SL {
 class Formatter: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        std::string formatted;
-       unsigned source_index;
-       unsigned source_line;
-       unsigned indent;
-       bool parameter_list;
-       bool omit_builtin;
-       bool r_empty_name;
+       unsigned source_index = 0;
+       unsigned source_line = 1;
+       unsigned indent = 0;
+       bool parameter_list = false;
+       bool omit_builtin = false;
+       bool r_empty_name = false;
 
 public:
-       Formatter();
-
        std::string apply(Stage &);
 
 private:
index 83af09a6f8b092bfb9cf3a76d949644ae5638793..258244e88b4e2457b441a75bfe9ecbed24fcc2b8 100644 (file)
@@ -49,13 +49,6 @@ bool can_convert(const BasicTypeDeclaration &from, const BasicTypeDeclaration &t
 
 unsigned TypeComparer::next_tag = 1;
 
-TypeComparer::TypeComparer():
-       first(0),
-       second(0),
-       first_tag(0),
-       r_result(false)
-{ }
-
 void TypeComparer::compare(Node &node1, Node &node2)
 {
        if(&node1==&node2)
@@ -234,10 +227,6 @@ void TypeComparer::visit(VariableDeclaration &var)
 }
 
 
-LocationCounter::LocationCounter():
-       r_count(0)
-{ }
-
 void LocationCounter::visit(BasicTypeDeclaration &basic)
 {
        r_count = basic.kind==BasicTypeDeclaration::MATRIX ? basic.size>>16 : 1;
index 6c00bca8de3d7f5f8dc3372dfd45cc8937b0568f..d48fbec156506f31fda79fd86aa676b8257a128d 100644 (file)
@@ -16,16 +16,14 @@ bool can_convert(const BasicTypeDeclaration &, const BasicTypeDeclaration &);
 class TypeComparer: private NodeVisitor
 {
 private:
-       Node *first;
-       Node *second;
-       unsigned first_tag;
-       bool r_result;
+       Node *first = 0;
+       Node *second = 0;
+       unsigned first_tag = 0;
+       bool r_result = false;
 
        static unsigned next_tag;
 
 public:
-       TypeComparer();
-
        bool apply(TypeDeclaration &t1, TypeDeclaration &t2) { compare(t1, t2); return r_result; }
 
 private:
@@ -47,11 +45,9 @@ private:
 class LocationCounter: private NodeVisitor
 {
 private:
-       unsigned r_count;
+       unsigned r_count = 0;
 
 public:
-       LocationCounter();
-
        unsigned apply(VariableDeclaration &v) { v.visit(*this); return r_count; }
 
 private:
@@ -74,9 +70,9 @@ public:
                Result(unsigned s, unsigned a): size(s), alignment(a), stride(s+a-1-(s+a-1)%a) { }
        };
 private:
-       unsigned r_size;
-       unsigned r_alignment;
-       int r_offset;
+       unsigned r_size = 0;
+       unsigned r_alignment = 1;
+       int r_offset = -1;
 
 public:
        Result apply(VariableDeclaration &v) { v.visit(*this); return Result(r_size, r_alignment); }
index 96ca492123962a464e77b4de57f9427f6196bdd0..c62f19e57fb4dea5abc4b59ce55541bca14ee890 100644 (file)
@@ -17,12 +17,6 @@ void BlockHierarchyResolver::enter(Block &block)
 }
 
 
-TypeResolver::TypeResolver():
-       stage(0),
-       iface_block(0),
-       r_any_resolved(false)
-{ }
-
 bool TypeResolver::apply(Stage &s)
 {
        stage = &s;
@@ -151,13 +145,6 @@ void TypeResolver::visit(FunctionDeclaration &func)
 }
 
 
-VariableResolver::VariableResolver():
-       stage(0),
-       r_any_resolved(false),
-       record_target(false),
-       r_self_referencing(false)
-{ }
-
 bool VariableResolver::apply(Stage &s)
 {
        stage = &s;
@@ -444,11 +431,6 @@ void VariableResolver::visit(InterfaceBlock &iface)
 }
 
 
-ExpressionResolver::ExpressionResolver():
-       stage(0),
-       r_any_resolved(false)
-{ }
-
 bool ExpressionResolver::apply(Stage &s)
 {
        stage = &s;
index 633ff11d27b4382e66ce6240847ac84907b54f5a..f32d0cd530fe03b289d04176da2535e43e86221a 100644 (file)
@@ -15,11 +15,9 @@ namespace SL {
 class BlockHierarchyResolver: private TraversingVisitor
 {
 private:
-       bool r_any_resolved;
+       bool r_any_resolved = false;
 
 public:
-       BlockHierarchyResolver(): r_any_resolved(false) { }
-
        bool apply(Stage &s) { r_any_resolved = false; s.content.visit(*this); return r_any_resolved; }
 
 private:
@@ -30,16 +28,14 @@ private:
 class TypeResolver: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        std::map<TypeDeclaration *, TypeDeclaration *> alias_map;
        std::map<TypeDeclaration *, TypeDeclaration *> array_types;
        NodeList<Statement>::iterator type_insert_point;
-       InterfaceBlock *iface_block;
-       bool r_any_resolved;
+       InterfaceBlock *iface_block = 0;
+       bool r_any_resolved = false;
 
 public:
-       TypeResolver();
-
        bool apply(Stage &);
 
 private:
@@ -59,18 +55,16 @@ of an interface block are turned into interface block references. */
 class VariableResolver: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        RefPtr<Expression> r_replacement_expr;
-       bool r_any_resolved;
-       bool record_target;
-       bool r_self_referencing;
+       bool r_any_resolved = false;
+       bool record_target = false;
+       bool r_self_referencing = false;
        Assignment::Target r_assignment_target;
        std::vector<VariableDeclaration *> redeclared_builtins;
        std::set<Node *> nodes_to_remove;
 
 public:
-       VariableResolver();
-
        bool apply(Stage &);
 
 private:
@@ -102,20 +96,16 @@ private:
 
        struct ArgumentInfo
        {
-               BasicTypeDeclaration *type;
-               unsigned component_count;
-
-               ArgumentInfo(): type(0), component_count(0) { }
+               BasicTypeDeclaration *type = 0;
+               unsigned component_count = 0;
        };
 
-       Stage *stage;
+       Stage *stage = 0;
        std::vector<BasicTypeDeclaration *> basic_types;
        NodeList<Statement>::iterator insert_point;
-       bool r_any_resolved;
+       bool r_any_resolved = false;
 
 public:
-       ExpressionResolver();
-
        bool apply(Stage &);
 
 private:
@@ -148,9 +138,9 @@ private:
 class FunctionResolver: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        std::map<std::string, std::vector<FunctionDeclaration *> > declarations;
-       bool r_any_resolved;
+       bool r_any_resolved = false;
 
 public:
        bool apply(Stage &);
index b81931e1143dfe24719833444257e7d235adedd5..6c4dd476289736e7778f2cc3d371f7980efd2f60 100644 (file)
@@ -9,10 +9,6 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
-SourceMap::SourceMap():
-       base_index(0)
-{ }
-
 void SourceMap::set_name(unsigned i, const string &n)
 {
        if(source_names.empty())
index da1f9b760032dca93ca70c07cdf1576ee9fc9938..5622d289d71611c7393b47a6cf5b722f433f5c06 100644 (file)
@@ -11,12 +11,10 @@ namespace SL {
 class SourceMap
 {
 private:
-       unsigned base_index;
+       unsigned base_index = 0;
        std::vector<std::string> source_names;
 
 public:
-       SourceMap();
-
        void set_name(unsigned, const std::string &);
        unsigned get_count() const { return base_index+source_names.size(); }
        const std::string &get_name(unsigned) const;
index 1da748a64eb297f23f5f135aa3743af92eabbaea..233d15488dd043de95408e3642c075aba9d2d280 100644 (file)
@@ -132,20 +132,7 @@ const SpirVGenerator::BuiltinFunctionInfo SpirVGenerator::builtin_functions[] =
 };
 
 SpirVGenerator::SpirVGenerator():
-       stage(0),
-       current_function(0),
-       writer(content),
-       next_id(1),
-       r_expression_result_id(0),
-       constant_expression(false),
-       spec_constant(false),
-       reachable(false),
-       composite_access(false),
-       r_composite_base_id(0),
-       r_composite_base(0),
-       assignment_source_id(0),
-       loop_merge_block_id(0),
-       loop_continue_target_id(0)
+       writer(content)
 { }
 
 void SpirVGenerator::apply(Module &module)
index 669342f36a5bb3297bb76ac8a9e8e74913d210bb..6971e2a9c43eb2ec8cc180b94043a6388229858e 100644 (file)
@@ -70,8 +70,8 @@ private:
                bool operator<(const ConstantKey &) const;
        };
 
-       Stage *stage;
-       FunctionDeclaration *current_function;
+       Stage *stage = 0;
+       FunctionDeclaration *current_function = 0;
        std::vector<const InterfaceLayout *> interface_layouts;
        SpirVContent content;
        SpirVWriter writer;
@@ -86,19 +86,19 @@ private:
        std::map<std::string, Id> function_type_ids;
        std::map<ConstantKey, Id> constant_ids;
        std::map<const VariableDeclaration *, Id> variable_load_ids;
-       Id next_id;
-       Id r_expression_result_id;
-       bool r_constant_result;
-       bool constant_expression;
-       bool spec_constant;
-       bool reachable;
-       bool composite_access;
-       Id r_composite_base_id;
-       Node *r_composite_base;
+       Id next_id = 1;
+       Id r_expression_result_id = 0;
+       bool r_constant_result = false;
+       bool constant_expression = false;
+       bool spec_constant = false;
+       bool reachable = false;
+       bool composite_access = false;
+       Id r_composite_base_id = 0;
+       Node *r_composite_base = 0;
        std::vector<unsigned> r_composite_chain;
-       Id assignment_source_id;
-       Id loop_merge_block_id;
-       Id loop_continue_target_id;
+       Id assignment_source_id = 0;
+       Id loop_merge_block_id = 0;
+       Id loop_continue_target_id = 0;
 
        static const BuiltinFunctionInfo builtin_functions[];
 
index bb8d7dab046f2ea1293927d93aa3e415818e12d4..dff52639b0e2c835d43a4f622f4d4b590d8b13cf 100644 (file)
@@ -75,11 +75,6 @@ NodeContainer<C>::NodeContainer(const NodeContainer &c):
 }
 
 
-Block::Block():
-       use_braces(false),
-       parent(0)
-{ }
-
 Block::Block(const Block &other):
        Node(other),
        body(other.body),
@@ -93,27 +88,15 @@ void Block::visit(NodeVisitor &visitor)
 }
 
 
-Expression::Expression():
-       oper(0),
-       type(0),
-       lvalue(false)
-{ }
-
-
 void Literal::visit(NodeVisitor &visitor)
 {
        visitor.visit(*this);
 }
 
 
-VariableReference::VariableReference():
-       declaration(0)
-{ }
-
 VariableReference::VariableReference(const VariableReference &other):
        Expression(other),
-       name(other.name),
-       declaration(0)
+       name(other.name)
 { }
 
 void VariableReference::visit(NodeVisitor &visitor)
@@ -122,14 +105,9 @@ void VariableReference::visit(NodeVisitor &visitor)
 }
 
 
-InterfaceBlockReference::InterfaceBlockReference():
-       declaration(0)
-{ }
-
 InterfaceBlockReference::InterfaceBlockReference(const InterfaceBlockReference &other):
        Expression(other),
-       name(other.name),
-       declaration(0)
+       name(other.name)
 { }
 
 void InterfaceBlockReference::visit(NodeVisitor &visitor)
@@ -138,17 +116,11 @@ void InterfaceBlockReference::visit(NodeVisitor &visitor)
 }
 
 
-MemberAccess::MemberAccess():
-       declaration(0),
-       index(-1)
-{ }
-
 MemberAccess::MemberAccess(const MemberAccess &other):
        Expression(other),
        left(other.left),
-       member(other.member),
-       declaration(0),
-       index(-1)
+       member(other.member)
+       // Do not copy declaration
 { }
 
 void MemberAccess::visit(NodeVisitor &visitor)
@@ -157,12 +129,6 @@ void MemberAccess::visit(NodeVisitor &visitor)
 }
 
 
-Swizzle::Swizzle():
-       count(0)
-{
-       fill(components, components+4, 0);
-}
-
 void Swizzle::visit(NodeVisitor &visitor)
 {
        visitor.visit(*this);
@@ -181,13 +147,10 @@ void BinaryExpression::visit(NodeVisitor &visitor)
 }
 
 
-Assignment::Assignment():
-       self_referencing(false)
-{ }
-
 Assignment::Assignment(const Assignment &other):
        BinaryExpression(other),
        self_referencing(other.self_referencing)
+       // Do not copy target
 { }
 
 void Assignment::visit(NodeVisitor &visitor)
@@ -196,13 +159,6 @@ void Assignment::visit(NodeVisitor &visitor)
 }
 
 
-Assignment::Target::Target(Statement *d):
-       declaration(d),
-       chain_len(0)
-{
-       fill(chain, chain+7, 0);
-}
-
 bool Assignment::Target::operator<(const Target &other) const
 {
        if(declaration!=other.declaration)
@@ -220,17 +176,12 @@ void TernaryExpression::visit(NodeVisitor &visitor)
 }
 
 
-FunctionCall::FunctionCall():
-       constructor(false),
-       declaration(0)
-{ }
-
 FunctionCall::FunctionCall(const FunctionCall &other):
        Expression(other),
        name(other.name),
        constructor(other.constructor),
-       arguments(other.arguments),
-       declaration(0)
+       arguments(other.arguments)
+       // Do not copy declaration
 { }
 
 void FunctionCall::visit(NodeVisitor &visitor)
@@ -269,20 +220,13 @@ void InterfaceLayout::visit(NodeVisitor &visitor)
 }
 
 
-BasicTypeDeclaration::BasicTypeDeclaration():
-       kind(ALIAS),
-       size(0),
-       sign(true),
-       base_type(0)
-{ }
-
 BasicTypeDeclaration::BasicTypeDeclaration(const BasicTypeDeclaration &other):
        TypeDeclaration(other),
        kind(other.kind),
        size(other.size),
        sign(other.sign),
-       base(other.base),
-       base_type(0)
+       base(other.base)
+       // Do not copy base type
 { }
 
 void BasicTypeDeclaration::visit(NodeVisitor &visitor)
@@ -291,29 +235,21 @@ void BasicTypeDeclaration::visit(NodeVisitor &visitor)
 }
 
 
-ImageTypeDeclaration::ImageTypeDeclaration():
-       dimensions(TWO),
-       array(false),
-       sampled(true),
-       shadow(false)
-{ }
-
 void ImageTypeDeclaration::visit(NodeVisitor &visitor)
 {
        visitor.visit(*this);
 }
 
 
-StructDeclaration::StructDeclaration():
-       interface_block(0)
+StructDeclaration::StructDeclaration()
 {
        members.use_braces = true;
 }
 
 StructDeclaration::StructDeclaration(const StructDeclaration &other):
        TypeDeclaration(other),
-       members(other.members),
-       interface_block(0)
+       members(other.members)
+       // Do not copy interface block
 { }
 
 StructDeclaration::~StructDeclaration()
@@ -328,13 +264,6 @@ void StructDeclaration::visit(NodeVisitor &visitor)
 }
 
 
-VariableDeclaration::VariableDeclaration():
-       constant(false),
-       array(false),
-       type_declaration(0),
-       linked_declaration(0)
-{ }
-
 VariableDeclaration::VariableDeclaration(const VariableDeclaration &other):
        Statement(other),
        layout(other.layout),
@@ -347,9 +276,8 @@ VariableDeclaration::VariableDeclaration(const VariableDeclaration &other):
        name(other.name),
        array(other.array),
        array_size(other.array_size),
-       init_expression(other.init_expression),
-       type_declaration(0),
-       linked_declaration(0)
+       init_expression(other.init_expression)
+       // Do not copy type and linked declarations
 { }
 
 VariableDeclaration::~VariableDeclaration()
@@ -364,23 +292,14 @@ void VariableDeclaration::visit(NodeVisitor &visitor)
 }
 
 
-InterfaceBlock::InterfaceBlock():
-       array(false),
-       type_declaration(0),
-       struct_declaration(0),
-       linked_block(0)
-{ }
-
 InterfaceBlock::InterfaceBlock(const InterfaceBlock &other):
        Statement(other),
        interface(other.interface),
        block_name(other.block_name),
        members(other.members),
        instance_name(other.instance_name),
-       array(other.array),
-       type_declaration(0),
-       struct_declaration(0),
-       linked_block(0)
+       array(other.array)
+       // Do not copy pointers to other nodes
 { }
 
 InterfaceBlock::~InterfaceBlock()
@@ -397,13 +316,6 @@ void InterfaceBlock::visit(NodeVisitor &visitor)
 }
 
 
-FunctionDeclaration::FunctionDeclaration():
-       virtua(false),
-       overrd(false),
-       definition(0),
-       return_type_declaration(0)
-{ }
-
 FunctionDeclaration::FunctionDeclaration(const FunctionDeclaration &other):
        Statement(other),
        return_type(other.return_type),
@@ -413,8 +325,8 @@ FunctionDeclaration::FunctionDeclaration(const FunctionDeclaration &other):
        overrd(other.overrd),
        body(other.body),
        signature(other.signature),
-       definition(other.definition==&other ? this : 0),
-       return_type_declaration(0)
+       definition(other.definition==&other ? this : 0)
+       // Do not copy return type declaration
 { }
 
 void FunctionDeclaration::visit(NodeVisitor &visitor)
index 7fa116b717dd388e5a2acba6001dc34c74226bab..a3b217d40895f2d6e4ae790abec56082094b6e95 100644 (file)
@@ -60,15 +60,15 @@ struct NodeVisitor;
 
 struct Node
 {
-       int source;
-       unsigned line;
+       int source = GENERATED_SOURCE;
+       unsigned line = 1;
 
-       Node(): source(GENERATED_SOURCE), line(1) { }
-       Node(const Node &n): source(n.source), line(n.line) { }
+       Node() = default;
+       Node(const Node &) = default;
 private:
        Node &operator=(const Node &);
 public:
-       virtual ~Node() { }
+       virtual ~Node() = default;
 
        virtual Node *clone() const = 0;
        virtual void visit(NodeVisitor &) = 0;
@@ -78,10 +78,10 @@ template<typename T>
 class NodePtr: public RefPtr<T>
 {
 public:
-       NodePtr() { }
+       NodePtr() = default;
        NodePtr(T *p): RefPtr<T>(p) { }
        NodePtr(const NodePtr &p): RefPtr<T>(p ? p->clone() : 0) { }
-       NodePtr &operator=(const NodePtr &p) { RefPtr<T>::operator=(p); return *this; }
+       NodePtr &operator=(const NodePtr &p) = default;
 
        template<typename U>
        NodePtr(const RefPtr<U> &p): RefPtr<T>(p) { }
@@ -94,7 +94,7 @@ template<typename C>
 class NodeContainer: public C
 {
 public:
-       NodeContainer() { }
+       NodeContainer() = default;
        NodeContainer(const NodeContainer &);
 
        void push_back_nocopy(const typename C::value_type &v)
@@ -122,12 +122,12 @@ struct Statement: Node
 struct Block: Node
 {
        NodeList<Statement> body;
-       bool use_braces;
+       bool use_braces = false;
 
        std::map<std::string, VariableDeclaration *> variables;
-       Block *parent;
+       Block *parent = 0;
 
-       Block();
+       Block() = default;
        Block(const Block &);
 
        virtual Block *clone() const { return new Block(*this); }
@@ -136,12 +136,10 @@ struct Block: Node
 
 struct Expression: Node
 {
-       const Operator *oper;
+       const Operator *oper = 0;
 
-       TypeDeclaration *type;
-       bool lvalue;
-
-       Expression();
+       TypeDeclaration *type = 0;
+       bool lvalue = false;
 
        virtual Expression *clone() const = 0;
 };
@@ -159,9 +157,9 @@ struct VariableReference: Expression
 {
        std::string name;
 
-       VariableDeclaration *declaration;
+       VariableDeclaration *declaration = 0;
 
-       VariableReference();
+       VariableReference() = default;
        VariableReference(const VariableReference &);
 
        virtual VariableReference *clone() const { return new VariableReference(*this); }
@@ -172,9 +170,9 @@ struct InterfaceBlockReference: Expression
 {
        std::string name;
 
-       InterfaceBlock *declaration;
+       InterfaceBlock *declaration = 0;
 
-       InterfaceBlockReference();
+       InterfaceBlockReference() = default;
        InterfaceBlockReference(const InterfaceBlockReference &);
 
        virtual InterfaceBlockReference *clone() const { return new InterfaceBlockReference(*this); }
@@ -186,10 +184,10 @@ struct MemberAccess: Expression
        NodePtr<Expression> left;
        std::string member;
 
-       VariableDeclaration *declaration;
-       int index;
+       VariableDeclaration *declaration = 0;
+       int index = -1;
 
-       MemberAccess();
+       MemberAccess() = default;
        MemberAccess(const MemberAccess &);
 
        virtual MemberAccess *clone() const { return new MemberAccess(*this); }
@@ -200,10 +198,8 @@ struct Swizzle: Expression
 {
        NodePtr<Expression> left;
        std::string component_group;
-       unsigned count;
-       std::uint8_t components[4];
-
-       Swizzle();
+       unsigned count = 0;
+       std::uint8_t components[4] = { 0, 0, 0, 0 };
 
        virtual Swizzle *clone() const { return new Swizzle(*this); }
        virtual void visit(NodeVisitor &);
@@ -237,20 +233,20 @@ struct Assignment: BinaryExpression
                        ARRAY = 0xC0
                };
 
-               Statement *declaration;
-               std::uint8_t chain_len;
-               std::uint8_t chain[7];
+               Statement *declaration = 0;
+               std::uint8_t chain_len = 0;
+               std::uint8_t chain[7] = { };
 
-               Target(Statement * = 0);
+               Target(Statement *d = 0): declaration(d) { }
 
                bool operator<(const Target &) const;
        };
 
-       bool self_referencing;
+       bool self_referencing = false;
 
        Target target;
 
-       Assignment();
+       Assignment() = default;
        Assignment(const Assignment &);
 
        virtual Assignment *clone() const { return new Assignment(*this); }
@@ -270,12 +266,12 @@ struct TernaryExpression: Expression
 struct FunctionCall: Expression
 {
        std::string name;
-       bool constructor;
+       bool constructor = false;
        NodeArray<Expression> arguments;
 
-       FunctionDeclaration *declaration;
+       FunctionDeclaration *declaration = 0;
 
-       FunctionCall();
+       FunctionCall() = default;
        FunctionCall(const FunctionCall &);
 
        virtual FunctionCall *clone() const { return new FunctionCall(*this); }
@@ -355,14 +351,14 @@ struct BasicTypeDeclaration: TypeDeclaration
                ARRAY
        };
 
-       Kind kind;
-       unsigned size;
-       bool sign;
+       Kind kind = ALIAS;
+       unsigned size = 0;
+       bool sign = true;
        std::string base;
 
-       TypeDeclaration *base_type;
+       TypeDeclaration *base_type = 0;
 
-       BasicTypeDeclaration();
+       BasicTypeDeclaration() = default;
        BasicTypeDeclaration(const BasicTypeDeclaration &);
 
        virtual BasicTypeDeclaration *clone() const { return new BasicTypeDeclaration(*this); }
@@ -379,15 +375,13 @@ struct ImageTypeDeclaration: TypeDeclaration
                CUBE
        };
 
-       Dimensions dimensions;
-       bool array;
-       bool sampled;
-       bool shadow;
+       Dimensions dimensions = TWO;
+       bool array = false;
+       bool sampled = true;
+       bool shadow = false;
        std::string base;
 
-       TypeDeclaration *base_type;
-
-       ImageTypeDeclaration();
+       TypeDeclaration *base_type = 0;
 
        virtual ImageTypeDeclaration *clone() const { return new ImageTypeDeclaration(*this); }
        virtual void visit(NodeVisitor &);
@@ -397,7 +391,7 @@ struct StructDeclaration: TypeDeclaration
 {
        Block members;
 
-       InterfaceBlock *interface_block;
+       InterfaceBlock *interface_block = 0;
 
        StructDeclaration();
        StructDeclaration(const StructDeclaration &);
@@ -410,21 +404,21 @@ struct StructDeclaration: TypeDeclaration
 struct VariableDeclaration: Statement
 {
        NodePtr<Layout> layout;
-       bool constant;
+       bool constant = false;
        std::string sampling;
        std::string interpolation;
        std::string interface;
        std::string precision;
        std::string type;
        std::string name;
-       bool array;
+       bool array = false;
        NodePtr<Expression> array_size;
        NodePtr<Expression> init_expression;
 
-       TypeDeclaration *type_declaration;
-       VariableDeclaration *linked_declaration;
+       TypeDeclaration *type_declaration = 0;
+       VariableDeclaration *linked_declaration = 0;
 
-       VariableDeclaration();
+       VariableDeclaration() = default;
        VariableDeclaration(const VariableDeclaration &);
        ~VariableDeclaration();
 
@@ -439,15 +433,15 @@ struct InterfaceBlock: Statement
        std::string block_name;
        NodePtr<Block> members;
        std::string instance_name;
-       bool array;
+       bool array = false;
 
        /* An interface block's ultimate base type is always a struct.  The
        immediate type may be either that same struct or an array of it. */
-       TypeDeclaration *type_declaration;
-       StructDeclaration *struct_declaration;
-       InterfaceBlock *linked_block;
+       TypeDeclaration *type_declaration = 0;
+       StructDeclaration *struct_declaration = 0;
+       InterfaceBlock *linked_block = 0;
 
-       InterfaceBlock();
+       InterfaceBlock() = default;
        InterfaceBlock(const InterfaceBlock &);
        ~InterfaceBlock();
 
@@ -460,15 +454,15 @@ struct FunctionDeclaration: Statement
        std::string return_type;
        std::string name;
        NodeArray<VariableDeclaration> parameters;
-       bool virtua;
-       bool overrd;
+       bool virtua = false;
+       bool overrd = false;
        Block body;
 
        std::string signature;
-       FunctionDeclaration *definition;
-       TypeDeclaration *return_type_declaration;
+       FunctionDeclaration *definition = 0;
+       TypeDeclaration *return_type_declaration = 0;
 
-       FunctionDeclaration();
+       FunctionDeclaration() = default;
        FunctionDeclaration(const FunctionDeclaration &);
 
        virtual FunctionDeclaration *clone() const { return new FunctionDeclaration(*this); }
index 595a97abc71e28402fef288be5f7c9636bc87e28..4064d805e732dc8adaf5dbb912df1ce0824909bb 100644 (file)
@@ -10,9 +10,7 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
-Tokenizer::Tokenizer():
-       allow_preprocess(true),
-       suppress_line_advance(false)
+Tokenizer::Tokenizer()
 {
        static string empty;
        iter = empty.begin();
index 46aa62fbea282c61ae016dd232f39b6fa73971f9..26c4b93c683ac7316fff92fda8aa8ab082215298 100644 (file)
@@ -14,9 +14,9 @@ class Preprocessor;
 struct Location
 {
        std::string name;
-       unsigned line;
+       unsigned line = 0;
 
-       Location(): line(0) { }
+       Location() = default;
        Location(const std::string &n, unsigned l): name(n), line(l) { }
 };
 
@@ -29,9 +29,9 @@ private:
        std::string::const_iterator iter;
        std::string::const_iterator source_end;
        Location location;
-       bool progress_mark;
-       bool allow_preprocess;
-       bool suppress_line_advance;
+       bool progress_mark = false;
+       bool allow_preprocess = true;
+       bool suppress_line_advance = false;
        std::string last_token;
        std::deque<std::string> next_tokens;
 
index ce30c2abdf44fe9156476e9eba145063c90fde43..0c4b98cbb2c8fd9de87ec21b553d911febde227a 100644 (file)
@@ -12,11 +12,6 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
-Validator::Validator():
-       stage(0),
-       last_provoker(0)
-{ }
-
 void Validator::diagnose(Node &node, Node &provoking_node, Diagnostic::Severity severity, const string &message)
 {
        Diagnostic diag;
@@ -39,13 +34,6 @@ void Validator::add_info(Node &node, const string &message)
 }
 
 
-DeclarationValidator::DeclarationValidator():
-       scope(GLOBAL),
-       iface_layout(0),
-       iface_block(0),
-       variable(0)
-{ }
-
 const char *DeclarationValidator::describe_variable(ScopeType scope)
 {
        switch(scope)
@@ -305,10 +293,6 @@ void DeclarationValidator::visit(FunctionDeclaration &func)
 }
 
 
-IdentifierValidator::IdentifierValidator():
-       anonymous_block(false)
-{ }
-
 void IdentifierValidator::multiple_definition(const string &name, Statement &statement, Statement &previous)
 {
        error(statement, format("Multiple definition of %s", name));
@@ -506,11 +490,6 @@ void ReferenceValidator::visit(FunctionDeclaration &func)
 }
 
 
-ExpressionValidator::ExpressionValidator():
-       current_function(0),
-       constant_expression(false)
-{ }
-
 void ExpressionValidator::visit(VariableReference &var)
 {
        if(var.declaration && constant_expression && !var.declaration->constant)
@@ -698,10 +677,6 @@ void ExpressionValidator::visit(Return &ret)
 }
 
 
-FlowControlValidator::FlowControlValidator():
-       reachable(true)
-{ }
-
 void FlowControlValidator::visit(Block &block)
 {
        for(const RefPtr<Statement> &s: block.body)
index d38849012e26fd4569919eaff31588fb144c3559..52ae136bb61da6053f425cd1d70cc2ad87231be9 100644 (file)
@@ -15,10 +15,10 @@ messages. */
 class Validator: protected TraversingVisitor
 {
 protected:
-       Stage *stage;
-       Node *last_provoker;
+       Stage *stage = 0;
+       Node *last_provoker = 0;
 
-       Validator();
+       Validator() = default;
 
        void diagnose(Node &, Node &, Diagnostic::Severity, const std::string &);
        void diagnose(Node &n, Diagnostic::Severity s, const std::string &m) { diagnose(n, n, s, m); }
@@ -39,14 +39,12 @@ private:
                FUNCTION
        };
 
-       ScopeType scope;
-       InterfaceLayout *iface_layout;
-       InterfaceBlock *iface_block;
-       VariableDeclaration *variable;
+       ScopeType scope = GLOBAL;
+       InterfaceLayout *iface_layout = 0;
+       InterfaceBlock *iface_block = 0;
+       VariableDeclaration *variable = 0;
 
 public:
-       DeclarationValidator();
-
        void apply(Stage &s) { stage = &s; s.content.visit(*this); }
 
 private:
@@ -72,11 +70,9 @@ private:
        std::map<Block *, BlockDeclarationMap> declarations;
        std::map<std::string, InterfaceBlock *> interface_blocks;
        std::map<std::string, FunctionDeclaration *> overloaded_functions;
-       bool anonymous_block;
+       bool anonymous_block = false;
 
 public:
-       IdentifierValidator();
-
        void apply(Stage &s) { stage = &s; s.content.visit(*this); }
 
 private:
@@ -117,12 +113,10 @@ is indicated by a null result type. */
 class ExpressionValidator: private Validator
 {
 private:
-       FunctionDeclaration *current_function;
-       bool constant_expression;
+       FunctionDeclaration *current_function = 0;
+       bool constant_expression = false;
 
 public:
-       ExpressionValidator();
-
        void apply(Stage &s) { stage = &s; s.content.visit(*this); }
 
 private:
@@ -145,11 +139,9 @@ return statements.  Warnings are given about dead code. */
 class FlowControlValidator: private Validator
 {
 private:
-       bool reachable;
+       bool reachable = true;
 
 public:
-       FlowControlValidator();
-
        void apply(Stage &s) { stage = &s; s.content.visit(*this); }
 
 private:
@@ -186,15 +178,13 @@ class GlobalInterfaceValidator: private Validator
 private:
        struct Uniform
        {
-               Node *node;
-               TypeDeclaration *type;
+               Node *node = 0;
+               TypeDeclaration *type = 0;
                std::string name;
-               int location;
-               unsigned loc_count;
-               int desc_set;
-               int bind_point;
-
-               Uniform(): node(0), type(0), location(-1), loc_count(1), desc_set(0), bind_point(-1) { }
+               int location = -1;
+               unsigned loc_count = 1;
+               int desc_set = 0;
+               int bind_point = -1;
        };
 
        std::list<Uniform> uniforms;
index 5e56d91945f057a3a1013a9fe8c233d475926dc7..b0025982fc75255041187ef4d66ce58af5930997 100644 (file)
@@ -136,12 +136,6 @@ void TraversingVisitor::visit(Return &ret)
 }
 
 
-NodeRemover::NodeRemover():
-       stage(0),
-       to_remove(0),
-       recursive_remove(false)
-{ }
-
 void NodeRemover::apply(Stage &s, const set<Node *> &tr)
 {
        stage = &s;
@@ -220,11 +214,6 @@ void NodeRemover::visit(Iteration &iter)
 }
 
 
-NodeReorderer::NodeReorderer():
-       reorder_before(0),
-       to_reorder(0)
-{ }
-
 void NodeReorderer::apply(Stage &stage, Node &before, const set<Node *> &tr)
 {
        reorder_before = &before;
index ed2534cb31b865900e142a141632fc4f35be497a..622a4834910d9d1f1a1f8e74db8c06af6c29a506 100644 (file)
@@ -13,9 +13,9 @@ namespace SL {
 class NodeVisitor
 {
 protected:
-       NodeVisitor() { }
+       NodeVisitor() = default;
 public:
-       virtual ~NodeVisitor() { }
+       virtual ~NodeVisitor() = default;
 
        virtual void visit(Block &) { }
        virtual void visit(Literal &) { }
@@ -50,9 +50,9 @@ public:
 class TraversingVisitor: public NodeVisitor
 {
 protected:
-       Block *current_block;
+       Block *current_block = 0;
 
-       TraversingVisitor(): current_block(0) { }
+       TraversingVisitor() = default;
 
 public:
        virtual void enter(Block &) { }
@@ -81,13 +81,11 @@ public:
 class NodeRemover: private TraversingVisitor
 {
 private:
-       Stage *stage;
-       const std::set<Node *> *to_remove;
-       bool recursive_remove;
+       Stage *stage = 0;
+       const std::set<Node *> *to_remove = 0;
+       bool recursive_remove = false;
 
 public:
-       NodeRemover();
-
        void apply(Stage &, const std::set<Node *> &);
 
 private:
@@ -110,12 +108,10 @@ on the same hierarchly level as the target node are reordered. */
 class NodeReorderer: private TraversingVisitor
 {
 private:
-       Node *reorder_before;
-       const std::set<Node *> *to_reorder;
+       Node *reorder_before = 0;
+       const std::set<Node *> *to_reorder = 0;
 
 public:
-       NodeReorderer();
-
        void apply(Stage &, Node &, const std::set<Node *> &);
 
 private:
index a306196afba7001b049ca5ae01e59a8bfca6c95f..0afc160ba3e35fd729249a4a0d446aea560698a9 100644 (file)
@@ -6,11 +6,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-DirectionalLight::DirectionalLight():
-       transmittance(1.0f),
-       direction(0.0f, 0.0f, -1.0f)
-{ }
-
 void DirectionalLight::update_matrix()
 {
        Vector3 up_dir;
index 8bde91cb2c94bb53947c9a9b0523ca9810088d3c..cdd8b4b8753cb51587f26977be14bc9b213e314b 100644 (file)
@@ -28,13 +28,9 @@ public:
        };
 
 private:
-       Color transmittance;
-       Vector3 direction;
+       Color transmittance = { 1.0f };
+       Vector3 direction = { 0.0f, 0.0f, -1.0f };
 
-public:
-       DirectionalLight();
-
-private:
        void update_matrix();
 
 public:
index 24bd8fa9c443483f581a8ed72b59a5df6e00445d..9a4c09b6760ef1bb8d7fadd08473ce297f2ef6ae 100644 (file)
@@ -9,11 +9,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Light::Light():
-       color(1.0f),
-       generation(0)
-{ }
-
 void Light::set_color(const Color &c)
 {
        color = c;
index c0f929cf24377cd4771793ba0fcee889b4736012..b20ebae44d3fe714f0a7bc4365f160bf3ae9b7e9 100644 (file)
@@ -48,12 +48,12 @@ public:
        };
 
 protected:
-       Color color;
-       unsigned generation;
+       Color color = { 1.0f };
+       unsigned generation = 0;
 
-       Light();
+       Light() = default;
 public:
-       virtual ~Light() { }
+       virtual ~Light() = default;
 
        /** Sets the color of the Light. */
        void set_color(const Color &);
index 77e7d44ec29bdedf174d393d5f505aba0cfeb18f..98baaa54ff2faf41b7975427dc4412306ac2e906 100644 (file)
@@ -68,12 +68,12 @@ public:
        };
 
 protected:
-       const Sampler *sampler;
+       const Sampler *sampler = 0;
        ProgramData shdata;
 
-       Material(): sampler(0) { }
+       Material() = default;
 public:
-       virtual ~Material() { }
+       virtual ~Material() = default;
 
        virtual const Program *create_compatible_shader(const std::map<std::string, int> & = std::map<std::string, int>()) const;
 protected:
index 4bbf4135dae9a7eabe6a24ba2c8a90cf62999781..9a726a2a982f143d1adaee43f9226c233d9ade7e 100644 (file)
@@ -6,11 +6,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-PointLight::PointLight():
-       position(0.0f, 0.0f, 0.0f),
-       attenuation{1.0f, 0.0f, 0.1f}
-{ }
-
 void PointLight::update_matrix()
 {
        matrix = Matrix::translation(position);
index 074c8c37b61d208cdd76cf9a97a59bfa8b47c9b7..1c37350439a61e8adac9d87581f6d453e365f1d0 100644 (file)
@@ -30,13 +30,9 @@ public:
        };
 
 private:
-       Vector3 position;
-       float attenuation[3];
+       Vector3 position = { 0.0f, 0.0f, 0.0f };
+       float attenuation[3] = { 1.0f, 0.0f, 0.1f };
 
-public:
-       PointLight();
-
-private:
        void update_matrix();
 
 public:
index 053197589ab1fe6e9d3c83c78261ffc3e27ebc0e..c5ad35d5b3e95976f6c35e047a0ed37fc9e630fc 100644 (file)
@@ -14,16 +14,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-RenderMethod::RenderMethod():
-       shprog(0),
-       shprog_from_material(false),
-       shdata(0),
-       material(0),
-       face_cull(CULL_BACK),
-       receive_shadows(false),
-       image_based_lighting(false)
-{ }
-
 void RenderMethod::set_material_textures()
 {
        const Tag *material_texture_tags = material->get_texture_tags();
index bf35aac57db1177e0a06ee229fe22a3197f64cf2..723aa5a25733c980c85d6db62e06eb1bc4d04669 100644 (file)
@@ -72,21 +72,17 @@ private:
                TextureSlot(Tag t): tag(t), texture(0), sampler(0) { }
        };
 
-       const Program *shprog;
-       bool shprog_from_material;
+       const Program *shprog = 0;
+       bool shprog_from_material = false;
        RefPtr<ProgramData> shdata;
        std::map<Tag, Tag> uniform_slots;
-       const Material *material;
+       const Material *material = 0;
        std::string material_slot;
        std::vector<TextureSlot> textures;
-       CullMode face_cull;
-       bool receive_shadows;
-       bool image_based_lighting;
+       CullMode face_cull = CULL_BACK;
+       bool receive_shadows = false;
+       bool image_based_lighting = false;
 
-public:
-       RenderMethod();
-
-private:
        void maybe_create_material_shader();
        void set_material_textures();
 
index d5d99c01f2196a67ca6204ef8d7f9b22a34bebb4..e1979051672481f277b953253589e88925c23716 100644 (file)
@@ -11,9 +11,7 @@ const Tag UnlitMaterial::texture_tags[] =
        Tag()
 };
 
-UnlitMaterial::UnlitMaterial():
-       texture(0),
-       vertex_color(false)
+UnlitMaterial::UnlitMaterial()
 {
        set_color(Color(1.0f));
 }
index 4481d5f988f446d446c048303666803c0af44e46..11641fa15be3a0b78de657af3669f0f399c12208 100644 (file)
@@ -24,9 +24,9 @@ public:
        };
 
 private:
-       const Texture *texture;
+       const Texture *texture = 0;
        Color color;
-       bool vertex_color;
+       bool vertex_color = false;
 
        static const Tag texture_tags[];
 
index 8b966464fd14d2ed42eb478d4b025f95bc1fbcfa..8f681a74bd19d843130e8bdccea6272e5808d506 100644 (file)
@@ -7,17 +7,7 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Camera::Camera():
-       fov(Geometry::Angle<float>::from_turns(0.125)),
-       height(0),
-       aspect(4.0/3.0),
-       clip_near(0.1),
-       clip_far(10),
-       frustum_x(0),
-       frustum_y(0),
-       position(0, 0, 0),
-       look_dir(0, 0, -1),
-       up_dir(0, 1, 0)
+Camera::Camera()
 {
        update_projection_matrix();
        update_object_matrix();
index 844ec0d8ef521311b0714fd470996f7e611c7d6e..0dd599298b3baed315f6d647cd932150feaa2511 100644 (file)
@@ -28,18 +28,18 @@ public:
        };
 
 private:
-       Geometry::Angle<float> fov;
-       float height;
-       float aspect;
+       Geometry::Angle<float> fov = Geometry::Angle<float>::from_turns(0.125f);
+       float height = 0.0f;
+       float aspect = 4.0f/3.0f;
        // Some compilers have "near" and "far" keywords
-       float clip_near;
-       float clip_far;
-       float frustum_x;
-       float frustum_y;
+       float clip_near = 0.1f;
+       float clip_far = 10.0f;
+       float frustum_x = 0.0f;
+       float frustum_y = 0.0f;
        Geometry::Angle<float> rotate;
-       Vector3 position;
-       Vector3 look_dir;
-       Vector3 up_dir;
+       Vector3 position = { 0.0f, 0.0f, 0.0f };
+       Vector3 look_dir = { 0.0f, 0.0f, -1.0f };
+       Vector3 up_dir = { 0.0f, 1.0f, 0.0f };
        Matrix view_matrix;
        Matrix proj_matrix;
        ProgramData shdata;
index ccc7b97ecdd0086db8f6b6029fc9546e94b82771..9a9f759ccf4b53a2c255617b01ade7e12cbc0b42 100644 (file)
@@ -17,13 +17,11 @@ namespace GL {
 const Matrix Object::identity_matrix;
 
 Object::Object():
-       lods(1),
-       lod0_watched(false)
+       lods(1)
 { }
 
 Object::Object(const Mesh *m, const Technique *t):
-       lods(1),
-       lod0_watched(false)
+       Object()
 {
        set_mesh(m);
        set_technique(t);
index 80a73cba61e2caf6ac53281af7bb7ded14c303e8..b6bd3a69d9b5c00ff74a14233963a11787eb70fb 100644 (file)
@@ -67,7 +67,7 @@ private:
 
        std::vector<LevelOfDetail> lods;
        Geometry::BoundingSphere<float, 3> bounding_sphere;
-       bool lod0_watched;
+       bool lod0_watched = false;
 
        static const Matrix identity_matrix;
 
index 81af42b3598e1f1cdc7054d0dabc8d41b29a05b9..fd6ea5de13b7c4aebc4b8140145a4d21769c3682 100644 (file)
@@ -14,10 +14,7 @@ namespace GL {
 OccludedScene::OccludedScene():
        bounding_mesh(Resources::get_global().get<Mesh>("_occluder.mesh")),
        bounding_shader(Resources::get_global().get<Program>("_occluder.glsl.shader")),
-       no_depth_write(LEQUAL, false),
-       occluder_min_size(0.25f),
-       queries(OCCLUSION_QUERY, 0),
-       cache_dirty(false)
+       queries(OCCLUSION_QUERY, 0)
 {
        no_color_write.write_mask = WRITE_NONE;
 }
@@ -151,13 +148,5 @@ void OccludedScene::render(Renderer &renderer, Tag tag) const
                        renderer.render(*i->renderable, tag);
 }
 
-
-OccludedScene::OccludedRenderable::OccludedRenderable():
-       renderable(0),
-       bounding_sphere(0),
-       in_frustum(false),
-       occluder(false)
-{ }
-
 } // namespace GL
 } // namespace Msp
index d51b29b36c87def2ef0ed1e7c30544a0aabea148..6efb354e37706cdcf4bece658678638f28f382ff 100644 (file)
@@ -26,23 +26,21 @@ public:
 private:
        struct OccludedRenderable
        {
-               Renderable *renderable;
-               const Geometry::BoundingSphere<float, 3> *bounding_sphere;
-               bool in_frustum;
-               bool occluder;
-
-               OccludedRenderable();
+               Renderable *renderable = 0;
+               const Geometry::BoundingSphere<float, 3> *bounding_sphere = 0;
+               bool in_frustum = false;
+               bool occluder = false;
        };
 
        const Mesh &bounding_mesh;
        const Program &bounding_shader;
        Blend no_color_write;
-       DepthTest no_depth_write;
+       DepthTest no_depth_write = { LEQUAL, false };
        std::set<Renderable *> renderables;
-       float occluder_min_size;
+       float occluder_min_size = 0.25f;
        mutable QueryPool queries;
        mutable std::vector<OccludedRenderable> occluded_cache;
-       mutable bool cache_dirty;
+       mutable bool cache_dirty = false;
 
 public:
        OccludedScene();
index 35999a06e1df5f30820511167d0c107d8941a955..6cb372354439bbdff1d7531186075e08f460dfb3 100644 (file)
@@ -15,9 +15,9 @@ class Placeable
 protected:
        Matrix matrix;
 
-       Placeable() { }
+       Placeable() = default;
 public:
-       virtual ~Placeable() { }
+       virtual ~Placeable() = default;
 
        virtual void set_matrix(const Matrix &);
 
@@ -30,7 +30,7 @@ public:
 class PlacedRenderable: public Renderable, public Placeable
 {
 protected:
-       PlacedRenderable() { }
+       PlacedRenderable() = default;
 
 public:
        /* Reimplement to clear ambiguity between Renderable and Placeable.  This
index 1dcac641907d382999943f27784946ab2465821d..43bcbf3febea57702fb6be343818b01d9d472325 100644 (file)
@@ -654,14 +654,6 @@ void ProgramData::set_debug_name(const string &name)
 }
 
 
-ProgramData::TaggedUniform::TaggedUniform():
-       type(VOID),
-       array_size(0),
-       data_offset(0),
-       data_size(0)
-{ }
-
-
 ProgramData::SharedBlock::SharedBlock(ReflectData::LayoutHash h):
        block_hash(h),
        used(0),
index e5c3e4f5259be76a3965f052e077a67bcaba1d34..2eef750cf78f7d4ff821ee9c1354cb395d6b6933 100644 (file)
@@ -101,12 +101,10 @@ private:
        struct TaggedUniform
        {
                Tag tag;
-               DataType type;
-               unsigned array_size;
-               unsigned data_offset;
-               unsigned data_size;
-
-               TaggedUniform();
+               DataType type = VOID;
+               unsigned array_size = 0;
+               unsigned data_offset = 0;
+               unsigned data_size = 0;
        };
 
        struct SharedBlock
index aa895eedbd0f0a128f6c1da617ca0e67b4ec2a44..a8da643029ae03ed5739522431ffd46f5740a1c7 100644 (file)
@@ -27,9 +27,9 @@ will occur before a setup_frame call or after a finish_frame call.
 class Renderable
 {
 protected:
-       Renderable() { }
+       Renderable() = default;
 public:
-       virtual ~Renderable() { }
+       virtual ~Renderable() = default;
 
        /** Returns the model matrix of the Renderable.  Null is returned if no such
        matrix exists.  The matrix should be in world space for some effects to work
index a515071d29f9d4cdb8ab5f74236369deeba5b3f9..ad5f87d5a4fd6fd8add9613b7562cb4415de0156 100644 (file)
@@ -359,36 +359,8 @@ void Renderer::apply_state()
 }
 
 
-Renderer::BoundTexture::BoundTexture():
-       unit(-1),
-       texture(0),
-       sampler(0),
-       replaced(-1)
-{ }
-
-
 Renderer::BoundProgramData::BoundProgramData(const ProgramData *d):
-       shdata(d),
-       generation(0)
-{ }
-
-
-Renderer::State::State():
-       camera(0),
-       framebuffer(0),
-       viewport(0),
-       scissor(0),
-       texture_count(0),
-       clipping(0),
-       shprog(0),
-       shdata_count(0),
-       vertex_setup(0),
-       front_face(NON_MANIFOLD),
-       face_cull(NO_CULL),
-       depth_test(0),
-       stencil_test(0),
-       blend(0),
-       object_lod_bias(0)
+       shdata(d)
 { }
 
 } // namespace GL
index af9eac0426e4c265a76bd2dc54879a5f85b636c3..fa7de736d1ff868b0be1874acb04c997b48254da 100644 (file)
@@ -69,42 +69,38 @@ private:
        struct BoundTexture
        {
                Tag tag;
-               mutable int unit;
-               const Texture *texture;
-               const Sampler *sampler;
-               int replaced;
-
-               BoundTexture();
+               mutable int unit = -1;
+               const Texture *texture = 0;
+               const Sampler *sampler = 0;
+               int replaced = -1;
        };
 
        struct BoundProgramData
        {
                const ProgramData *shdata;
-               mutable unsigned generation;
+               mutable unsigned generation = 0;
 
                BoundProgramData(const ProgramData *);
        };
 
        struct State
        {
-               const Camera *camera;
+               const Camera *camera = 0;
                Matrix model_matrix;
-               const Framebuffer *framebuffer;
-               const Rect *viewport;
-               const Rect *scissor;
-               unsigned texture_count;
-               const Clipping *clipping;
-               const Program *shprog;
-               unsigned shdata_count;
-               const VertexSetup *vertex_setup;
-               FaceWinding front_face;
-               CullMode face_cull;
-               const DepthTest *depth_test;
-               const StencilTest *stencil_test;
-               const Blend *blend;
-               unsigned object_lod_bias;
-
-               State();
+               const Framebuffer *framebuffer = 0;
+               const Rect *viewport = 0;
+               const Rect *scissor = 0;
+               unsigned texture_count = 0;
+               const Clipping *clipping = 0;
+               const Program *shprog = 0;
+               unsigned shdata_count = 0;
+               const VertexSetup *vertex_setup = 0;
+               FaceWinding front_face = NON_MANIFOLD;
+               CullMode face_cull = NO_CULL;
+               const DepthTest *depth_test = 0;
+               const StencilTest *stencil_test = 0;
+               const Blend *blend = 0;
+               unsigned object_lod_bias = 0;
        };
 
        enum ChangeMask
index e55de1a84323529dfe4300c6ebec210d52c8664e..8083239390fed6d765e546ae08ea2aadde14f2ce 100644 (file)
@@ -54,12 +54,12 @@ protected:
        mutable Matrix culling_matrix;
        mutable Vector4 frustum_edges[6];
 
-       Scene() { }
+       Scene() = default;
 private:
        Scene(const Scene &);
        Scene &operator=(const Scene &);
 public:
-       virtual ~Scene() { }
+       virtual ~Scene() = default;
 
        virtual void add(Renderable &) = 0;
        virtual void remove(Renderable &) = 0;
index e0c333dec2b26b679ed0b293063678b9c5b6680d..f2a88a51f760ab6ccc6fc9e5c17062ab460824ae 100644 (file)
@@ -12,24 +12,10 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Sequence::Sequence():
-       width(0),
-       height(0),
-       target{0, 0},
-       target_ms(0),
-       clear_enabled(false),
-       clear_depth(1.0f),
-       clear_stencil(0)
-{ }
-
 Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f):
        width(w),
        height(h),
-       target_format(f),
-       target_ms(0),
-       clear_enabled(false),
-       clear_depth(1.0f),
-       clear_stencil(0)
+       target_format(f)
 {
        if(target_format.empty())
                throw invalid_argument("Sequence::Sequence");
index ebdb55dd664636936ea9caea0c01de1a11c2a843..cc4b6963b017ce98b2250597d2f02c8c55f67988 100644 (file)
@@ -73,18 +73,18 @@ private:
 
        std::vector<Step> steps;
        std::vector<PostProcStep> postproc;
-       unsigned width;
-       unsigned height;
+       unsigned width = 0;
+       unsigned height = 0;
        FrameFormat target_format;
-       RenderTarget *target[2];
-       RenderTarget *target_ms;
-       bool clear_enabled;
+       RenderTarget *target[2] = { 0, 0 };
+       RenderTarget *target_ms = 0;
+       bool clear_enabled = false;
        std::vector<Color> clear_colors;
-       float clear_depth;
-       int clear_stencil;
+       float clear_depth = 1.0f;
+       int clear_stencil = 0;
 
 public:
-       Sequence();
+       Sequence() = default;
        Sequence(unsigned, unsigned, const FrameFormat &);
        ~Sequence();
 
index 6e811bdec2c9faa514b448dee64e9b8c57af5f84..7b77f45ecf82d8b9262f1a1effa4f4a108036302 100644 (file)
@@ -4,10 +4,6 @@
 namespace Msp {
 namespace GL {
 
-Slot::Slot():
-       renderable(0)
-{ }
-
 void Slot::set(Renderable *r)
 {
        renderable = r;
index 9129869ed8fcc46ff9992995d34d78cd8907243c..40dfd7587abed4c2ce615533c84a69b1faa4cde7 100644 (file)
@@ -13,11 +13,9 @@ needs to be switched without affecting the rest.
 class Slot: public Renderable
 {
 private:
-       Renderable *renderable;
+       Renderable *renderable = 0;
 
 public:
-       Slot();
-
        void set(Renderable *);
        Renderable *get() const { return renderable; }
 
index cb7f998e9bb2a38d4102024fc4648e8461b38f0c..a51d2cf16778a82bc3778c47203a618f39b5cc91 100644 (file)
@@ -13,10 +13,7 @@ namespace GL {
 Text::Text(const Font &f, const Technique *tech, Tag tex_slot):
        ObjectInstance(object),
        font(f),
-       mesh((TEXCOORD2, VERTEX2)),
-       horz_align(0.0f),
-       vert_offset(0.0f),
-       width(0.0f)
+       mesh((TEXCOORD2, VERTEX2))
 {
        object.set_mesh(&mesh);
        if(tech)
index 0b4fa92c4ac5fe0197dbc917f19bb6453eded733..c007c81f8aeaee0c9813dbf66915ccdd12814400 100644 (file)
@@ -37,9 +37,9 @@ private:
        Mesh mesh;
        Object object;
        Tag texture_slot;
-       float horz_align;
-       float vert_offset;
-       float width;
+       float horz_align = 0.0f;
+       float vert_offset = 0.0f;
+       float width = 0.0f;
 
 public:
        Text(const Font &, const Technique * = 0, Tag = Tag());
index 7b64fb2b478387b448eac09acd32e9e418af31f2..b9833dadff84ed31f5418bd2a526b3a905d9cd51 100644 (file)
@@ -7,11 +7,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-ZSortedScene::ZSortedScene():
-       order(BACK_TO_FRONT),
-       reference(FURTHEST)
-{ }
-
 void ZSortedScene::add(Renderable &r)
 {
        if(renderables.insert(&r).second && !sorted_cache.empty())
index 9653567c107be6d88b50a096d5a7b825b1b739fc..6806547235962793fc976d7613d28e49ed516708 100644 (file)
@@ -43,13 +43,11 @@ private:
        };
 
        std::set<Renderable *> renderables;
-       SortOrder order;
-       DepthReference reference;
+       SortOrder order = BACK_TO_FRONT;
+       DepthReference reference = FURTHEST;
        mutable std::vector<SortedRenderable> sorted_cache;
 
 public:
-       ZSortedScene();
-
        virtual void add(Renderable &);
        virtual void remove(Renderable &);
 
index 4be6ee26bcef7d6bafa241a42fdf0bf00dde1fe4..644c55bb0ca198c167655249406e5f540e3b26b4 100644 (file)
@@ -4,10 +4,6 @@
 namespace Msp {
 namespace GL {
 
-Resource::Resource():
-       manager(0)
-{ }
-
 Resource::~Resource()
 {
        if(manager)
index 4efc082116eefcde6a1b3035b4ee354eea97f3a6..1fdbb3ef3fd906142a92a13b2e1e3ed3add4225f 100644 (file)
@@ -25,10 +25,10 @@ public:
        };
 
 protected:
-       ResourceManager *manager;
-       void *manager_data;
+       ResourceManager *manager = 0;
+       void *manager_data = 0;
 
-       Resource();
+       Resource() = default;
 public:
        virtual ~Resource();
 
index 5358183f24bc5a39d156b6f9bcab1c87136bac31..f25e6ad1db1b53e609b68cf8d8d9559848da7b66 100644 (file)
@@ -21,17 +21,6 @@ resource_load_error::resource_load_error(const string &name, const exception &ex
 { }
 
 
-ResourceManager::ResourceManager():
-       policy(LOAD_ON_DEMAND),
-       async_loads(true),
-       total_data_size(0),
-       size_limit(0),
-       frame(0),
-       min_retain_frames(30),
-       max_retain_frames(0),
-       next_unload(0)
-{ }
-
 ResourceManager::~ResourceManager()
 {
        thread.terminate();
index 2b9aef58f6414af9073988898e08e04483861e6a..bd87de8929ad92fc38b2703313168d2df1d75628 100644 (file)
@@ -112,21 +112,20 @@ private:
                void terminate();
        };
 
-       LoadingPolicy policy;
-       bool async_loads;
+       LoadingPolicy policy = LOAD_ON_DEMAND;
+       bool async_loads = true;
        mutable Mutex map_mutex;
        std::map<const Resource *, ManagedResource> resources;
        std::deque<ManagedResource *> queue;
-       std::uint64_t total_data_size;
-       std::uint64_t size_limit;
-       unsigned frame;
-       unsigned min_retain_frames;
-       unsigned max_retain_frames;
-       unsigned next_unload;
+       std::uint64_t total_data_size = 0;
+       std::uint64_t size_limit = 0;
+       unsigned frame = 0;
+       unsigned min_retain_frames = 30;
+       unsigned max_retain_frames = 0;
+       unsigned next_unload = 0;
        LoadingThread thread;
 
 public:
-       ResourceManager();
        ~ResourceManager();
 
        void set_loading_policy(LoadingPolicy);
index d1313d329261f50f7de06e9cf4692a0d6a32b186..ab971c1b97d7a0d8420555fc8e88886f2df55814 100644 (file)
@@ -9,9 +9,9 @@ class Resource;
 class ResourceObserver
 {
 protected:
-       ResourceObserver() { }
+       ResourceObserver() = default;
 public:
-       virtual ~ResourceObserver() { }
+       virtual ~ResourceObserver() = default;
 
        virtual void resource_loaded(Resource &) { }
        virtual void resource_unloaded(Resource &) { }