Remove shaders for drawin sun/moon
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "canvas/BackGround.hpp"
|
||||
#include "canvas/BackGroundColors.hpp"
|
||||
#include "canvas/Circle.hpp"
|
||||
#include "canvas/stb_perlin.h"
|
||||
|
||||
#include <raylib.h>
|
||||
@@ -44,6 +43,9 @@ Color ColorAdd(Color c1, Color c2)
|
||||
void BackGround::init(int canvasSize)
|
||||
{
|
||||
this->canvasSize = canvasSize;
|
||||
// resitev da ne postane tekstura okoli sonca transparentna in da se ne vidi nasledna slika
|
||||
// https://github.com/raysan5/raylib/issues/3820
|
||||
rlSetBlendFactorsSeparate(RL_SRC_ALPHA, RL_ONE_MINUS_SRC_ALPHA, RL_ONE, RL_ONE, RL_FUNC_ADD, RL_MAX);
|
||||
}
|
||||
|
||||
void BackGround::deinit()
|
||||
@@ -117,26 +119,45 @@ void BackGround::drawStars()
|
||||
|
||||
void BackGround::drawSun()
|
||||
{
|
||||
int r = ((m_dna->moonY / 255.0f * (maxSizeOfMoon - minSizeOfMoon)) + minSizeOfMoon) * canvasSize;
|
||||
int radius = ((m_dna->moonY / 255.0f * (maxSizeOfMoon - minSizeOfMoon)) + minSizeOfMoon) * canvasSize;
|
||||
int xpos = Lerp(canvasSize * moonXOffset, canvasSize - canvasSize * moonXOffset, m_dna->moonX / 255.0f);
|
||||
int ypos = Lerp(canvasSize * moonXOffset, maxYPosOfMoon * canvasSize, m_dna->moonY / 255.0f);
|
||||
|
||||
Color color = {0};
|
||||
if (getColorSet() == 3)
|
||||
{
|
||||
Circle::setColor(BackGroundColors::moonColor);
|
||||
r = (((m_dna->moonSize / 255.0f) * (maxSizeOfMoon - minSizeOfMoon)) + minSizeOfMoon) * canvasSize;
|
||||
color = BackGroundColors::moonColor;
|
||||
radius = (((m_dna->moonSize / 255.0f) * (maxSizeOfMoon - minSizeOfMoon)) + minSizeOfMoon) * canvasSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
Color color = {0};
|
||||
color.r = 255;
|
||||
color.g = std::lerp(200, 50, m_dna->moonY / 255.0f);
|
||||
color.b = std::lerp(50, 0, m_dna->moonY / 255.0f);
|
||||
color.a = 255;
|
||||
|
||||
Circle::setColor(color);
|
||||
}
|
||||
Circle::draw(xpos, ypos, r);
|
||||
|
||||
BeginBlendMode(RL_BLEND_CUSTOM_SEPARATE);
|
||||
|
||||
constexpr float numOfCircles = 15.0f;
|
||||
constexpr float sunMin = 1.7f;
|
||||
|
||||
float amount = 0.0f;
|
||||
color.a = 15;
|
||||
for (size_t i = 0; i < numOfCircles; i++)
|
||||
{
|
||||
|
||||
float r = Lerp(radius, radius / sunMin, amount);
|
||||
DrawCircle(xpos, ypos, r, color);
|
||||
amount += 1.0f / numOfCircles;
|
||||
}
|
||||
|
||||
|
||||
EndBlendMode();
|
||||
|
||||
color.a = 255;
|
||||
DrawCircle(xpos, ypos, radius / sunMin, color);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void BackGround::drawMounten(size_t mountenSegments, int min, int max, Color color, float scale)
|
||||
|
||||
Reference in New Issue
Block a user