Add DNA to tree

This commit is contained in:
2024-12-21 00:20:43 +01:00
parent ee7b674c6d
commit 2a215ead5f
6 changed files with 57 additions and 57 deletions

View File

@@ -5,9 +5,8 @@
#include <raymath.h>
Dna newDna()
void newDna(Dna &dna)
{
Dna dna = {0};
dna.moon = {mrand::getFloat(), mrand::getFloat(), mrand::getFloat()};
dna.colorSet = mrand::getValue(0, 3);
dna.time = std::floor(Remap(mrand::getFloat(), 0, 1, 4, 0));
@@ -21,5 +20,19 @@ Dna newDna()
dna.starSeed.c = mrand::getInt();
dna.starSeed.d = mrand::getInt();
return dna;
for (size_t i = 0; i < MAX_DEPTH; i++)
{
uint8_t r = mrand::getValue(0, 255);
uint8_t g = mrand::getValue(0, 255);
uint8_t b = mrand::getValue(0, 255);
dna.branches[i].color = {r, g, b, 255};
dna.branches[i].numOfBranches = mrand::getValue(1, 3);
dna.branches[i].lenghthRatio = ((float)mrand::getValue(600, 700)) / 1000.0f;
}
dna.branches[0].color = dna.branches[1].color;
return;
}