From: Mikko Rasa Date: Sat, 9 Oct 2021 11:11:09 +0000 (+0300) Subject: Use default member initializers for simple types X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=38712d8ecc57d043a2419ffbaeeb57f7a6586f14;p=libs%2Fgl.git Use default member initializers for simple types Also mark special member functions as defaulted instead of defining them as empty. --- diff --git a/source/animation/animation.cpp b/source/animation/animation.cpp index 98cfdc87..76d9552e 100644 --- a/source/animation/animation.cpp +++ b/source/animation/animation.cpp @@ -16,11 +16,6 @@ using namespace std; namespace Msp { namespace GL { -Animation::Animation(): - armature(0), - looping(false) -{ } - Animation::~Animation() { for(TimedKeyFrame &k: keyframes) diff --git a/source/animation/animation.h b/source/animation/animation.h index eb5911c3..7d55bb61 100644 --- a/source/animation/animation.h +++ b/source/animation/animation.h @@ -163,16 +163,15 @@ public: }; private: - const Armature *armature; + const Armature *armature = 0; std::vector keyframes; std::vector events; - bool looping; + bool looping = false; std::vector uniforms; std::vector curves; - unsigned uniform_curve_offset; + unsigned uniform_curve_offset = 0; public: - Animation(); ~Animation(); void set_armature(const Armature &); diff --git a/source/animation/animationeventobserver.h b/source/animation/animationeventobserver.h index 1eafc4d2..b1d57e97 100644 --- a/source/animation/animationeventobserver.h +++ b/source/animation/animationeventobserver.h @@ -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 &) { } }; diff --git a/source/animation/keyframe.cpp b/source/animation/keyframe.cpp index 3f3dea28..d1f1a7ea 100644 --- a/source/animation/keyframe.cpp +++ b/source/animation/keyframe.cpp @@ -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; diff --git a/source/animation/keyframe.h b/source/animation/keyframe.h index 26d18534..5e70aa73 100644 --- a/source/animation/keyframe.h +++ b/source/animation/keyframe.h @@ -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 &); diff --git a/source/animation/pose.cpp b/source/animation/pose.cpp index 99fa6bb3..2faecad3 100644 --- a/source/animation/pose.cpp +++ b/source/animation/pose.cpp @@ -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); } diff --git a/source/animation/pose.h b/source/animation/pose.h index cbd8137b..d0c127ed 100644 --- a/source/animation/pose.h +++ b/source/animation/pose.h @@ -40,11 +40,11 @@ private: void rotation(float, float, float, float); }; - const Armature *armature; + const Armature *armature = 0; std::vector links; public: - Pose(); + Pose() = default; Pose(const Armature &); void set_armature(const Armature &); diff --git a/source/animation/transform.cpp b/source/animation/transform.cpp index b703a5b1..4c8e1564 100644 --- a/source/animation/transform.cpp +++ b/source/animation/transform.cpp @@ -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; diff --git a/source/animation/transform.h b/source/animation/transform.h index 1d0aeddd..5854c417 100644 --- a/source/animation/transform.h +++ b/source/animation/transform.h @@ -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 &); diff --git a/source/backends/opengl/buffer_backend.h b/source/backends/opengl/buffer_backend.h index 7162a26b..5db516fb 100644 --- a/source/backends/opengl/buffer_backend.h +++ b/source/backends/opengl/buffer_backend.h @@ -13,7 +13,7 @@ class OpenGLBuffer: public NonCopyable friend class OpenGLVertexSetup; protected: - unsigned id; + unsigned id = 0; static OpenGLBuffer *scratch_binding; diff --git a/source/backends/opengl/commands_backend.cpp b/source/backends/opengl/commands_backend.cpp index e9fa8b7c..adecd5c8 100644 --- a/source/backends/opengl/commands_backend.cpp +++ b/source/backends/opengl/commands_backend.cpp @@ -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; diff --git a/source/backends/opengl/commands_backend.h b/source/backends/opengl/commands_backend.h index f54b27a1..0fe989a7 100644 --- a/source/backends/opengl/commands_backend.h +++ b/source/backends/opengl/commands_backend.h @@ -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 *); diff --git a/source/backends/opengl/program_backend.cpp b/source/backends/opengl/program_backend.cpp index 3b1c4293..4dbf38a7 100644 --- a/source/backends/opengl/program_backend.cpp +++ b/source/backends/opengl/program_backend.cpp @@ -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() diff --git a/source/backends/opengl/program_backend.h b/source/backends/opengl/program_backend.h index 4ae729e2..95df9891 100644 --- a/source/backends/opengl/program_backend.h +++ b/source/backends/opengl/program_backend.h @@ -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 uniform_calls; std::string debug_name; diff --git a/source/backends/opengl/sampler_backend.h b/source/backends/opengl/sampler_backend.h index 77590c25..20ad4b6c 100644 --- a/source/backends/opengl/sampler_backend.h +++ b/source/backends/opengl/sampler_backend.h @@ -9,7 +9,7 @@ class OpenGLSampler friend class OpenGLPipelineState; protected: - unsigned id; + unsigned id = 0; OpenGLSampler(); diff --git a/source/backends/opengl/texture_backend.cpp b/source/backends/opengl/texture_backend.cpp index e8288045..88e1c2b3 100644 --- a/source/backends/opengl/texture_backend.cpp +++ b/source/backends/opengl/texture_backend.cpp @@ -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; diff --git a/source/backends/opengl/texture_backend.h b/source/backends/opengl/texture_backend.h index 81577820..a18b7bf8 100644 --- a/source/backends/opengl/texture_backend.h +++ b/source/backends/opengl/texture_backend.h @@ -12,7 +12,7 @@ class OpenGLTexture: public NonCopyable friend class OpenGLPipelineState; protected: - unsigned id; + unsigned id = 0; unsigned target; std::string debug_name; diff --git a/source/builders/font.cpp b/source/builders/font.cpp index 4fb64352..58b23fe9 100644 --- a/source/builders/font.cpp +++ b/source/builders/font.cpp @@ -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(f, &c) { diff --git a/source/builders/font.h b/source/builders/font.h index f46a2870..adbfc828 100644 --- a/source/builders/font.h +++ b/source/builders/font.h @@ -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 KerningMap; typedef std::map 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; diff --git a/source/builders/geometrybuilder.cpp b/source/builders/geometrybuilder.cpp index 8e0ae53b..52d05fae 100644 --- a/source/builders/geometrybuilder.cpp +++ b/source/builders/geometrybuilder.cpp @@ -4,11 +4,6 @@ namespace Msp { namespace GL { -GeometryBuilder::GeometryBuilder(): - generate_tan(false), - tex_fit(STRETCH) -{ } - GeometryBuilder &GeometryBuilder::tangents(bool t) { generate_tan = t; diff --git a/source/builders/geometrybuilder.h b/source/builders/geometrybuilder.h index 87dd4e22..04b26251 100644 --- a/source/builders/geometrybuilder.h +++ b/source/builders/geometrybuilder.h @@ -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); } diff --git a/source/builders/sequencetemplate.cpp b/source/builders/sequencetemplate.cpp index 5d7f4d0b..e8e451fc 100644 --- a/source/builders/sequencetemplate.cpp +++ b/source/builders/sequencetemplate.cpp @@ -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) { } diff --git a/source/builders/sequencetemplate.h b/source/builders/sequencetemplate.h index 52c42bb1..972a6b0b 100644 --- a/source/builders/sequencetemplate.h +++ b/source/builders/sequencetemplate.h @@ -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 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 steps; std::vector postprocessors; - bool clear_enabled; + bool clear_enabled = false; std::vector 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; } diff --git a/source/builders/vertexbuilder.h b/source/builders/vertexbuilder.h index 49a20b5c..09d9ed60 100644 --- a/source/builders/vertexbuilder.h +++ b/source/builders/vertexbuilder.h @@ -40,7 +40,7 @@ protected: public: VertexBuilder() { normal(0, 0, 1); } - virtual ~VertexBuilder() { } + virtual ~VertexBuilder() = default; void set_matrix(const Matrix &m) { mtx = m; } diff --git a/source/core/backend.cpp b/source/core/backend.cpp index ac9e22b7..2e8f6b42 100644 --- a/source/core/backend.cpp +++ b/source/core/backend.cpp @@ -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; diff --git a/source/core/backend.h b/source/core/backend.h index 0dd0172c..ef04bd11 100644 --- a/source/core/backend.h +++ b/source/core/backend.h @@ -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 &); diff --git a/source/core/blend.cpp b/source/core/blend.cpp index 85d3e57d..99ffcd07 100644 --- a/source/core/blend.cpp +++ b/source/core/blend.cpp @@ -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) { } diff --git a/source/core/blend.h b/source/core/blend.h index e04aef49..1d39b08f 100644 --- a/source/core/blend.h +++ b/source/core/blend.h @@ -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); }; diff --git a/source/core/buffer.cpp b/source/core/buffer.cpp index 811b3e41..523b737d 100644 --- a/source/core/buffer.cpp +++ b/source/core/buffer.cpp @@ -8,10 +8,6 @@ using namespace std; namespace Msp { namespace GL { -Buffer::Buffer(): - size(0) -{ } - void Buffer::storage(unsigned sz) { if(size>0) diff --git a/source/core/buffer.h b/source/core/buffer.h index 9737a2ea..7682347f 100644 --- a/source/core/buffer.h +++ b/source/core/buffer.h @@ -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); diff --git a/source/core/bufferable.cpp b/source/core/bufferable.cpp index abbde263..8f967df7 100644 --- a/source/core/bufferable.cpp +++ b/source/core/bufferable.cpp @@ -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(); diff --git a/source/core/bufferable.h b/source/core/bufferable.h index 47e2770c..c7e26aef 100644 --- a/source/core/bufferable.h +++ b/source/core/bufferable.h @@ -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(); diff --git a/source/core/clipplane.cpp b/source/core/clipplane.cpp index fe784d25..256f2bea 100644 --- a/source/core/clipplane.cpp +++ b/source/core/clipplane.cpp @@ -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) diff --git a/source/core/clipplane.h b/source/core/clipplane.h index 2cf9b18b..a2b56255 100644 --- a/source/core/clipplane.h +++ b/source/core/clipplane.h @@ -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 &); diff --git a/source/core/color.h b/source/core/color.h index e57689bf..e376e330 100644 --- a/source/core/color.h +++ b/source/core/color.h @@ -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)); } diff --git a/source/core/depthtest.cpp b/source/core/depthtest.cpp index 5ae4f728..dcd76023 100644 --- a/source/core/depthtest.cpp +++ b/source/core/depthtest.cpp @@ -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), diff --git a/source/core/depthtest.h b/source/core/depthtest.h index d79f06e8..e6f1349a 100644 --- a/source/core/depthtest.h +++ b/source/core/depthtest.h @@ -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); }; diff --git a/source/core/framebuffer.cpp b/source/core/framebuffer.cpp index 61327723..cc8dec4f 100644 --- a/source/core/framebuffer.cpp +++ b/source/core/framebuffer.cpp @@ -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; diff --git a/source/core/framebuffer.h b/source/core/framebuffer.h index 0b9af1ef..e370b7c7 100644 --- a/source/core/framebuffer.h +++ b/source/core/framebuffer.h @@ -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(); }; diff --git a/source/core/frameformat.cpp b/source/core/frameformat.cpp index 36b45f61..7fe17933 100644 --- a/source/core/frameformat.cpp +++ b/source/core/frameformat.cpp @@ -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) diff --git a/source/core/frameformat.h b/source/core/frameformat.h index 90132092..df436375 100644 --- a/source/core/frameformat.h +++ b/source/core/frameformat.h @@ -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; diff --git a/source/core/mesh.cpp b/source/core/mesh.cpp index 1e811b5b..4679e3a3 100644 --- a/source/core/mesh.cpp +++ b/source/core/mesh.cpp @@ -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() { diff --git a/source/core/mesh.h b/source/core/mesh.h index 89f51fdd..2d56193d 100644 --- a/source/core/mesh.h +++ b/source/core/mesh.h @@ -66,16 +66,16 @@ private: VertexArray vertices; std::vector 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(); diff --git a/source/core/module.cpp b/source/core/module.cpp index ed5f0282..eaed8a45 100644 --- a/source/core/module.cpp +++ b/source/core/module.cpp @@ -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(-1)) -{ } - - uint32_t SpirVModule::Reflection::get_opcode(uint32_t op) { return op&0xFFFF; diff --git a/source/core/module.h b/source/core/module.h index 34553b44..7713d3ce 100644 --- a/source/core/module.h +++ b/source/core/module.h @@ -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 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 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(-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(-1); }; struct Reflection @@ -198,7 +190,7 @@ private: std::vector spec_constants; public: - SpirVModule() { } + SpirVModule() = default; SpirVModule(const SpirVModule &); SpirVModule &operator=(const SpirVModule &); private: diff --git a/source/core/pipelinestate.cpp b/source/core/pipelinestate.cpp index 15de0b4d..23a2ed6a 100644 --- a/source/core/pipelinestate.cpp +++ b/source/core/pipelinestate.cpp @@ -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 void PipelineState::set(T &target, T value, unsigned flag) { diff --git a/source/core/pipelinestate.h b/source/core/pipelinestate.h index 42543e4d..0d0520a0 100644 --- a/source/core/pipelinestate.h +++ b/source/core/pipelinestate.h @@ -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 textures; std::vector 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 void set(T &, T, unsigned); public: diff --git a/source/core/program.h b/source/core/program.h index f41a7d6d..fd1c1ae0 100644 --- a/source/core/program.h +++ b/source/core/program.h @@ -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::map()); diff --git a/source/core/rect.h b/source/core/rect.h index 333dbc25..4f6bd6bd 100644 --- a/source/core/rect.h +++ b/source/core/rect.h @@ -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) { } }; diff --git a/source/core/reflectdata.cpp b/source/core/reflectdata.cpp index 7a141db2..db679873 100644 --- a/source/core/reflectdata.cpp +++ b/source/core/reflectdata.cpp @@ -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->locationlocation; }); @@ -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 diff --git a/source/core/reflectdata.h b/source/core/reflectdata.h index 90b7ce0d..fff190a5 100644 --- a/source/core/reflectdata.h +++ b/source/core/reflectdata.h @@ -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 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 uniform_blocks; diff --git a/source/core/sampler.cpp b/source/core/sampler.cpp index 6f4770ac..6658ef9a 100644 --- a/source/core/sampler.cpp +++ b/source/core/sampler.cpp @@ -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); diff --git a/source/core/sampler.h b/source/core/sampler.h index bd8db31f..c7906877 100644 --- a/source/core/sampler.h +++ b/source/core/sampler.h @@ -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: diff --git a/source/core/stenciltest.cpp b/source/core/stenciltest.cpp index 2e8bbb4d..2a1f0a84 100644 --- a/source/core/stenciltest.cpp +++ b/source/core/stenciltest.cpp @@ -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(st) { diff --git a/source/core/stenciltest.h b/source/core/stenciltest.h index 652f8d40..47e7a627 100644 --- a/source/core/stenciltest.h +++ b/source/core/stenciltest.h @@ -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 &); diff --git a/source/core/tag.h b/source/core/tag.h index dbc0b3ef..edc33c63 100644 --- a/source/core/tag.h +++ b/source/core/tag.h @@ -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); diff --git a/source/core/texture1d.cpp b/source/core/texture1d.cpp index 1733a2d8..1015a0af 100644 --- a/source/core/texture1d.cpp +++ b/source/core/texture1d.cpp @@ -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) diff --git a/source/core/texture1d.h b/source/core/texture1d.h index 1871a17c..04284697 100644 --- a/source/core/texture1d.h +++ b/source/core/texture1d.h @@ -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 *); diff --git a/source/core/texture2d.cpp b/source/core/texture2d.cpp index 01612d73..3c3579c1 100644 --- a/source/core/texture2d.cpp +++ b/source/core/texture2d.cpp @@ -6,11 +6,6 @@ using namespace std; namespace Msp { namespace GL { -Texture2D::Texture2D(): - width(0), - height(0) -{ } - Texture2D::~Texture2D() { set_manager(0); diff --git a/source/core/texture2d.h b/source/core/texture2d.h index 4f0bde26..209cede5 100644 --- a/source/core/texture2d.h +++ b/source/core/texture2d.h @@ -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 diff --git a/source/core/texture2dmultisample.cpp b/source/core/texture2dmultisample.cpp index 5ea37e90..1c0106d7 100644 --- a/source/core/texture2dmultisample.cpp +++ b/source/core/texture2dmultisample.cpp @@ -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) diff --git a/source/core/texture2dmultisample.h b/source/core/texture2dmultisample.h index 9710ad78..8c3275c0 100644 --- a/source/core/texture2dmultisample.h +++ b/source/core/texture2dmultisample.h @@ -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); diff --git a/source/core/texture3d.cpp b/source/core/texture3d.cpp index 0fb26ccd..e48b7662 100644 --- a/source/core/texture3d.cpp +++ b/source/core/texture3d.cpp @@ -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) diff --git a/source/core/texture3d.h b/source/core/texture3d.h index 21893abc..4a166174 100644 --- a/source/core/texture3d.h +++ b/source/core/texture3d.h @@ -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. diff --git a/source/core/texturecube.cpp b/source/core/texturecube.cpp index ea294997..9aec4b1d 100644 --- a/source/core/texturecube.cpp +++ b/source/core/texturecube.cpp @@ -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) diff --git a/source/core/texturecube.h b/source/core/texturecube.h index 363ceea3..2f445919 100644 --- a/source/core/texturecube.h +++ b/source/core/texturecube.h @@ -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. diff --git a/source/core/vertexarray.cpp b/source/core/vertexarray.cpp index 30bc9bcc..796bef80 100644 --- a/source/core/vertexarray.cpp +++ b/source/core/vertexarray.cpp @@ -6,10 +6,6 @@ using namespace std; namespace Msp { namespace GL { -VertexArray::VertexArray(): - stride(0) -{ } - VertexArray::VertexArray(const VertexFormat &f) { set_format(f); diff --git a/source/core/vertexarray.h b/source/core/vertexarray.h index 290fa10c..d80b2786 100644 --- a/source/core/vertexarray.h +++ b/source/core/vertexarray.h @@ -32,12 +32,12 @@ public: private: VertexFormat format; std::vector 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 &); diff --git a/source/core/vertexformat.cpp b/source/core/vertexformat.cpp index b95da9d1..ff043f7d 100644 --- a/source/core/vertexformat.cpp +++ b/source/core/vertexformat.cpp @@ -7,10 +7,6 @@ using namespace std; namespace Msp { namespace GL { -VertexFormat::VertexFormat(): - count(0) -{ } - VertexFormat::VertexFormat(VertexAttribute a): count(1) { diff --git a/source/core/vertexformat.h b/source/core/vertexformat.h index f9f99398..4ff34017 100644 --- a/source/core/vertexformat.h +++ b/source/core/vertexformat.h @@ -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; diff --git a/source/core/vertexsetup.cpp b/source/core/vertexsetup.cpp index 4fd589a9..7b346d8e 100644 --- a/source/core/vertexsetup.cpp +++ b/source/core/vertexsetup.cpp @@ -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)) diff --git a/source/core/vertexsetup.h b/source/core/vertexsetup.h index 7daef884..208e55d3 100644 --- a/source/core/vertexsetup.h +++ b/source/core/vertexsetup.h @@ -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 &); diff --git a/source/effects/ambientocclusion.cpp b/source/effects/ambientocclusion.cpp index d431bcdd..8149e408 100644 --- a/source/effects/ambientocclusion.cpp +++ b/source/effects/ambientocclusion.cpp @@ -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 ao = new AmbientOcclusion(width/size_divisor, height/size_divisor); diff --git a/source/effects/ambientocclusion.h b/source/effects/ambientocclusion.h index fd3b6574..efaa2f37 100644 --- a/source/effects/ambientocclusion.h +++ b/source/effects/ambientocclusion.h @@ -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; }; diff --git a/source/effects/bloom.cpp b/source/effects/bloom.cpp index a6fefa6e..8a8dea3e 100644 --- a/source/effects/bloom.cpp +++ b/source/effects/bloom.cpp @@ -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 = new Bloom(width/size_divisor, height/size_divisor); diff --git a/source/effects/bloom.h b/source/effects/bloom.h index d6c9307c..94057b2f 100644 --- a/source/effects/bloom.h +++ b/source/effects/bloom.h @@ -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; }; diff --git a/source/effects/colorcurve.cpp b/source/effects/colorcurve.cpp index f4a786a4..c64f8531 100644 --- a/source/effects/colorcurve.cpp +++ b/source/effects/colorcurve.cpp @@ -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 = new ColorCurve(); diff --git a/source/effects/colorcurve.h b/source/effects/colorcurve.h index 01a7d35d..5cebcb00 100644 --- a/source/effects/colorcurve.h +++ b/source/effects/colorcurve.h @@ -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; }; diff --git a/source/effects/environmentmap.cpp b/source/effects/environmentmap.cpp index 47cea090..6fb0e5c3 100644 --- a/source/effects/environmentmap.cpp +++ b/source/effects/environmentmap.cpp @@ -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("_envmap_irradiance.glsl.shader")), specular_shprog(Resources::get_global().get("_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) diff --git a/source/effects/environmentmap.h b/source/effects/environmentmap.h index 2d27ee7d..f9f4cf53 100644 --- a/source/effects/environmentmap.h +++ b/source/effects/environmentmap.h @@ -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); diff --git a/source/effects/postprocessor.cpp b/source/effects/postprocessor.cpp index e6308634..246f6ef8 100644 --- a/source/effects/postprocessor.cpp +++ b/source/effects/postprocessor.cpp @@ -6,11 +6,6 @@ namespace Msp { namespace GL { -PostProcessor::Template::Template(): - size_divisor(1) -{ } - - PostProcessor::Template::Loader::Loader(Template &t): DataFile::ObjectLoader