aboutsummaryrefslogtreecommitdiff
path: root/visualization/extrasmeltutils.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2020-02-14 00:30:42 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2020-02-15 18:44:07 +0800
commit59b0a4f74fd358d44c65137e41594fc7dc8a106e (patch)
treecfc218d5e0b75123f6635d9e8609558a859ff4e5 /visualization/extrasmeltutils.hpp
parent002baf9367417604412ed19d283835c23454349e (diff)
downloadQMidiPlayer-59b0a4f74fd358d44c65137e41594fc7dc8a106e.tar.xz
New scheme for visualizing note velocity.
Updated default color scheme for better results. New class smColor, which is going to replace smColorHSVA & smColorRGBA in the future.
Diffstat (limited to 'visualization/extrasmeltutils.hpp')
-rw-r--r--visualization/extrasmeltutils.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/visualization/extrasmeltutils.hpp b/visualization/extrasmeltutils.hpp
index d827567..3cea3fc 100644
--- a/visualization/extrasmeltutils.hpp
+++ b/visualization/extrasmeltutils.hpp
@@ -1,3 +1,8 @@
+//Extra utilities for SMELT
+//Chris Xiong, 2016-2020
+//License: LGPL v3
+//This file contains staging extensions for SMELT,
+//which will be moved into SMELT once they are mature.
#ifndef EXTRASMELTUTILS_H
#define EXTRASMELTUTILS_H
#include <ctime>
@@ -5,6 +10,7 @@
#include <smelt.hpp>
#include <smmath.hpp>
#include <smrandom.hpp>
+#define EPSF 1e-6f
class smEntity3D
{
friend class smEntity3DBuffer;
@@ -34,6 +40,38 @@ class smEntity3DBuffer
void drawBatch();
};
+class smColor
+{
+ private:
+ float r,g,b,h,s,v,a;
+ void update_rgb();
+ void update_hsv();
+ public:
+ smColor();
+ void clamp(bool hsv);
+ float alpha()const;
+ float red()const;
+ float green()const;
+ float blue()const;
+ float hue()const;
+ float saturation()const;
+ float hslSaturation()const;
+ float value()const;
+ float lightness()const;
+ void setAlpha(float alpha);
+ void setRed(float red);
+ void setGreen(float green);
+ void setBlue(float blue);
+ void setHue(float hue);
+ void setSaturation(float saturation);
+ void setHSLSaturation(float saturation);
+ void setValue(float value);
+ void setLightness(float lightness);
+ smColor lighter(int factor);
+ smColor darker(int factor);
+ uint32_t toHWColor();
+ static smColor fromHWColor(uint32_t color);
+};
class smPSEmissionPositionGenerator
{
public: