Fix sun making everything transperent
and sun has beautiful gradient
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#include <vector>
|
||||
#include <raylib.h>
|
||||
|
||||
#include "values/RandBuffer.hpp"
|
||||
#include "canvas/Sun.hpp"
|
||||
|
||||
#include <raylib.h>
|
||||
|
||||
|
||||
struct Moon
|
||||
{
|
||||
@@ -16,14 +20,17 @@ public:
|
||||
BackGround() = default;
|
||||
~BackGround() = default;
|
||||
void init(int size);
|
||||
void deinit();
|
||||
void newGen();
|
||||
void draw();
|
||||
|
||||
private:
|
||||
void drawStarts();
|
||||
void drawMoon();
|
||||
void drawSun();
|
||||
void drawMounten(size_t mountenSegments, int min, int max, Color color);
|
||||
|
||||
Sun sun;
|
||||
|
||||
RandBuffer starBuff;
|
||||
RandBuffer mountenBuff;
|
||||
Moon m_moon;
|
||||
@@ -34,8 +41,8 @@ private:
|
||||
|
||||
constexpr static size_t numOfStarts = 150;
|
||||
constexpr static float moonXOffset = 0.1f;
|
||||
constexpr static float minSizeOfMoon = 0.05f;
|
||||
constexpr static float maxSizeOfMoon = 0.075f;
|
||||
constexpr static float minSizeOfMoon = 0.075f;
|
||||
constexpr static float maxSizeOfMoon = 0.1f;
|
||||
constexpr static float maxYPosOfMoon = 0.80f;
|
||||
constexpr static float bigRingRatio = 0.5f;
|
||||
constexpr static float smallRingRatio = 0.25f;
|
||||
|
@@ -9,8 +9,9 @@ public:
|
||||
Canvas() = default;
|
||||
~Canvas() = default;
|
||||
void init(int size);
|
||||
void deinit();
|
||||
void newGen(RenderTexture2D& target);
|
||||
|
||||
|
||||
private:
|
||||
BackGround backGround;
|
||||
Tree tree;
|
||||
|
25
inc/canvas/Sun.hpp
Normal file
25
inc/canvas/Sun.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <raylib.h>
|
||||
|
||||
class Sun
|
||||
{
|
||||
public:
|
||||
Sun() = default;
|
||||
~Sun() = default;
|
||||
void init();
|
||||
void deinit();
|
||||
void draw(float x, float y, float size);
|
||||
private:
|
||||
const int sizeTexute = 100;
|
||||
RenderTexture2D target = { 0 };
|
||||
Shader shader = { 0 };
|
||||
|
||||
float sun_radius = 0.60f;
|
||||
float start_transperency = 0.40f;
|
||||
float c[3] = { 240.0f / 255.0f, 240.0f / 255.0f, 190.0f / 255.0f };
|
||||
|
||||
int sun_radius_loc = 0;
|
||||
int start_transperency_loc = 0;
|
||||
int colorLoc = 0;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user