Low-Level C++ SDK  v1.2.0
Loading...
Searching...
No Matches
WeArtTexture.h
Go to the documentation of this file.
1
5#pragma once
6#include "WeArtCommon.h"
7
10public:
11 WeArtTexture() : active(false),
12 _textureType(DefaultTextureType),
13 _textureVelocity{ DefaultVelocity },
14 _volume(DefaultVolume) {};
15
16 WeArtTexture(bool active, TextureType type, float velocity, float textureVolume)
17 : active(active), _textureType(type) {
18 textureVelocity(velocity);
19 volume(textureVolume);
20 }
21
22 static constexpr TextureType DefaultTextureType = TextureType::ClickNormal;
23
24 static constexpr float DefaultVolume = 100.0f;
25 static constexpr float MinVolume = 0.0f;
26 static constexpr float MaxVolume = 100.0f;
27
28 static constexpr float DefaultVelocity = 0.0f;
29 static constexpr float MinVelocity = 0.0f;
30 static constexpr float MaxVelocity = 0.5f;
31
32 bool active;
33
36 float textureVelocity() const {
37 return _textureVelocity;
38 }
39
42 void textureVelocity(float velocity) {
43 _textureVelocity = velocity <= MinVelocity ? MinVelocity : velocity >= MaxVelocity ? MaxVelocity : velocity;
44 }
45
48 TextureType textureType() const {
49 return _textureType;
50 }
51
54 void textureType(TextureType type) {
55 TextureType lower = TextureType::ClickNormal;
56 TextureType upper = TextureType::DoubleSidedTape;
57 _textureType = type <= lower ? lower : type >= upper ? upper : type;
58 }
59
62 float volume() const {
63 return _volume;
64 }
65
68 void volume(float v) {
69 _volume = v <= MinVolume ? MinVolume : v >= MaxVolume ? MaxVolume : v;
70 }
71
72 bool operator==(const WeArtTexture& other) const {
73 return (active == other.active && _textureType == other.textureType() && _textureVelocity == other.textureVelocity() && _volume == other.volume());
74 };
75
76private:
77 float _volume;
78 TextureType _textureType;
79 float _textureVelocity;
80};
81
Temperature value to be applied to an effect.
Definition: WeArtTexture.h:9
static constexpr float DefaultVolume
Definition: WeArtTexture.h:24
static constexpr float MinVelocity
Definition: WeArtTexture.h:29
static constexpr float MinVolume
Definition: WeArtTexture.h:25
float textureVelocity() const
Gets the texture velocity.
Definition: WeArtTexture.h:36
static constexpr float DefaultVelocity
Definition: WeArtTexture.h:28
TextureType textureType() const
Texture type getter.
Definition: WeArtTexture.h:48
WeArtTexture()
Definition: WeArtTexture.h:11
WeArtTexture(bool active, TextureType type, float velocity, float textureVolume)
Definition: WeArtTexture.h:16
static constexpr float MaxVelocity
Definition: WeArtTexture.h:30
void textureType(TextureType type)
Texture type setter.
Definition: WeArtTexture.h:54
float volume() const
Volume value getter.
Definition: WeArtTexture.h:62
bool active
Definition: WeArtTexture.h:32
void textureVelocity(float velocity)
Sets the texture velocity (speed at which the vibration is emitted, between 0 and 0....
Definition: WeArtTexture.h:42
void volume(float v)
Volume value setter.
Definition: WeArtTexture.h:68
static constexpr TextureType DefaultTextureType
Definition: WeArtTexture.h:22
static constexpr float MaxVolume
Definition: WeArtTexture.h:26
bool operator==(const WeArtTexture &other) const
Definition: WeArtTexture.h:72