43 lines
765 B
C++
43 lines
765 B
C++
#include <cstdint>
|
|
#include <vector>
|
|
#include <list>
|
|
#include <raylib.h>
|
|
|
|
#include "values/Dna.hpp"
|
|
|
|
struct DrawArgs
|
|
{
|
|
Vector2 start;
|
|
float angleDeg;
|
|
int dep;
|
|
Color parent;
|
|
int size;
|
|
};
|
|
|
|
class Tree
|
|
{
|
|
|
|
public:
|
|
Tree() = default;
|
|
~Tree() = default;
|
|
void init(int size);
|
|
void draw(Dna *dna);
|
|
bool tick();
|
|
|
|
private:
|
|
Dna *m_dna;
|
|
uint128 branchSeed;
|
|
|
|
Vector2 start = {0};
|
|
std::list<DrawArgs> drawCalls;
|
|
|
|
void drawBranch();
|
|
|
|
inline size_t getNumOfBranches(int dep);
|
|
inline Color getStartColor(DrawArgs &arg);
|
|
inline Color getEndColor(int dep, Color &start);
|
|
inline int getStartSize(DrawArgs &arg);
|
|
inline int getEndSize(DrawArgs &arg, int start);
|
|
inline float getLength(DrawArgs &arg);
|
|
inline float getAngleVar(DrawArgs &arg);
|
|
}; |