v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
74
source/game/StarParallax.hpp
Normal file
74
source/game/StarParallax.hpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
#ifndef STAR_PARALLAX_HPP
|
||||
#define STAR_PARALLAX_HPP
|
||||
|
||||
#include "StarMaybe.hpp"
|
||||
#include "StarColor.hpp"
|
||||
#include "StarPlantDatabase.hpp"
|
||||
|
||||
namespace Star {
|
||||
|
||||
STAR_CLASS(Parallax);
|
||||
STAR_STRUCT(ParallaxLayer);
|
||||
|
||||
struct ParallaxLayer {
|
||||
ParallaxLayer();
|
||||
ParallaxLayer(Json const& store);
|
||||
|
||||
Json store() const;
|
||||
|
||||
void addImageDirectives(String const& newDirectives);
|
||||
void fadeToSkyColor(Color skyColor);
|
||||
|
||||
StringList textures;
|
||||
String directives;
|
||||
float alpha;
|
||||
Vec2F parallaxValue;
|
||||
Vec2B repeat;
|
||||
Maybe<float> tileLimitTop;
|
||||
Maybe<float> tileLimitBottom;
|
||||
float verticalOrigin;
|
||||
float zLevel;
|
||||
Vec2F parallaxOffset;
|
||||
String timeOfDayCorrelation;
|
||||
float speed;
|
||||
bool unlit;
|
||||
bool lightMapped;
|
||||
float fadePercent;
|
||||
};
|
||||
typedef List<ParallaxLayer> ParallaxLayers;
|
||||
|
||||
DataStream& operator>>(DataStream& ds, ParallaxLayer& parallaxLayer);
|
||||
DataStream& operator<<(DataStream& ds, ParallaxLayer const& parallaxLayer);
|
||||
|
||||
// Object managing and rendering the parallax for a World
|
||||
class Parallax {
|
||||
public:
|
||||
Parallax(String const& assetFile,
|
||||
uint64_t seed,
|
||||
float verticalOrigin,
|
||||
float hueShift,
|
||||
Maybe<TreeVariant> parallaxTreeVariant = {});
|
||||
Parallax(Json const& store);
|
||||
|
||||
Json store() const;
|
||||
|
||||
void fadeToSkyColor(Color const& skyColor);
|
||||
|
||||
ParallaxLayers const& layers() const;
|
||||
|
||||
private:
|
||||
void buildLayer(Json const& layerSettings, String const& kind);
|
||||
|
||||
uint64_t m_seed;
|
||||
float m_verticalOrigin;
|
||||
Maybe<TreeVariant> m_parallaxTreeVariant;
|
||||
float m_hueShift;
|
||||
|
||||
String m_imageDirectory;
|
||||
|
||||
ParallaxLayers m_layers;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue