Added relativity

This commit is contained in:
COW_ILLUMINATI 2024-04-30 16:27:39 -04:00
parent 193b970837
commit 8cc0eb7d49
5 changed files with 299363 additions and 99331 deletions

100012
Gal_data/Galaxy_a Normal file

File diff suppressed because it is too large Load Diff

0
Gal_data/Galaxy_b Normal file

@ -1,3 +1,3 @@
0.5
75
0.1
150
0

File diff suppressed because it is too large Load Diff

@ -15,6 +15,9 @@ class Vector3;
// Starts the clock
std::clock_t startTime = std::clock();
// Sets the constant
const float sol = 10.0; // Speed of light *should* be 1, but 10.0 make it compatible with old settings so I don't need to change the text in the creator
// Defines a pointer to the screen size (needs to be accessible everywhere, but the Vector3 class is still undefined!)
Vector3 *screenSize;
@ -233,11 +236,18 @@ struct Star
Star() {}
// Called ever subframe
void tick(float dt) {
void tick(float dt, bool relativistic) {
if (true){
acceleration = acceleration * (sol - sqrt(velocity.SqrMagnitude()))/sol;
}
// Calc intégral lets gooo
position = position + velocity * dt + acceleration * dt * dt * 0.5;
velocity = velocity + acceleration * dt;
acceleration = Vector3 (0,0,0);
}
// Calculates the field at a point in space
@ -464,7 +474,7 @@ int main() {
// Must update everything at the same time
#pragma omp parallel for
for (int i = 0 ; i < starCount ; i++) {
stars[i].tick(timestep);
stars[i].tick(timestep, i < sigStars);
}