OpenGothic
Open source reimplementation of Gothic I and II
Loading...
Searching...
No Matches
lightsource.h
Go to the documentation of this file.
1#pragma once
2
3#include <Tempest/Point>
4#include <vector>
5#include <string>
6#include <zenkit/Misc.hh>
7
8class LightSource final {
9 public:
11
12 Tempest::Vec3 dir() const { return ldir; }
13 void setDir(const Tempest::Vec3& d);
14 void setDir(float x,float y,float z);
15
16 const Tempest::Vec3& color() const { return clr; }
17 void setColor(const Tempest::Vec3& cl);
18 void setColor(const std::vector<uint32_t>& cl, float fps, bool smooth);
19 void setColor(const std::vector<zenkit::Color>& cl, float fps, bool smooth);
20 void setColor(const std::vector<Tempest::Vec3>& cl, float fps, bool smooth);
21
22 void setPosition(const Tempest::Vec3& p) { pos = p; }
23 const Tempest::Vec3& position() const { return pos; }
24
25 float range() const { return rgn; }
26 void setRange(float r);
27 void setRange(const std::vector<float>& rangeAniScale, float base, float fps, bool smooth);
28
29 void setEnabled(bool e);
30
31 void update(uint64_t time);
32 bool isDynamic() const;
33 bool isEnabled() const;
34 float currentRange() const { return curRgn; }
35 const Tempest::Vec3& currentColor() const { return curClr; }
36
37 void setTimeOffset(uint64_t t);
38
39 uint64_t effectPrefferedTime() const;
40
41 void setDebugName(std::string_view hint);
42 std::string_view debugName() const;
43
44 private:
45#ifndef NDEBUG
46 std::string dbgHint;
47#endif
48
49 Tempest::Vec3 ldir;
50 Tempest::Vec3 clr;
51 Tempest::Vec3 pos;
52 float rgn = 0;
53
54 uint64_t timeOff = 0;
55
56 std::vector<float> rangeAniScale;
57 uint64_t rangeAniFPSInv = 0;
58 bool rangeSmooth = false;
59
60 std::vector<Tempest::Vec3> colorAniList;
61 uint64_t colorAniListFpsInv = 0;
62 bool colorSmooth = false;
63
64 Tempest::Vec3 curClr;
65 float curRgn = 0;
66
67 bool enable = true;
68 };
69
void setDebugName(std::string_view hint)
const Tempest::Vec3 & position() const
Definition lightsource.h:23
float range() const
Definition lightsource.h:25
void setColor(const std::vector< Tempest::Vec3 > &cl, float fps, bool smooth)
void update(uint64_t time)
void setEnabled(bool e)
uint64_t effectPrefferedTime() const
float currentRange() const
Definition lightsource.h:34
void setDir(const Tempest::Vec3 &d)
std::string_view debugName() const
Tempest::Vec3 dir() const
Definition lightsource.h:12
const Tempest::Vec3 & color() const
Definition lightsource.h:16
const Tempest::Vec3 & currentColor() const
Definition lightsource.h:35
bool isDynamic() const
bool isEnabled() const
void setColor(const Tempest::Vec3 &cl)
void setPosition(const Tempest::Vec3 &p)
Definition lightsource.h:22
void setRange(float r)
void setTimeOffset(uint64_t t)